Articles

Methods provided by object class in java

Methods provided by object class in java


java.lang.Object is the base class of all the classes in java.

 

Object class provides number of methods that can be used by any class in java. 

 

Some of the methods provided by Object class are:

  • getClass()
  • hashCode()
  • equals(Object o)
  • toString()
  • finalize()
  • clone()
  • wait()
  • notify()
  • notifyAll()

Lets see few examples

 

Given below is an example which invokes getClass() and hashCode() method on class instance.


public class TIHDemo {

	public static void main(String[] args) {

		TIHDemo t = new TIHDemo();
		System.out.println(t.getClass());
		System.out.println(t.hashCode());

	}

}

OUTPUT

class TIHDemo
366712642

 

 


Java Interview Questions

Would you like to see your article here on tutorialsinhand. Join Write4Us program by tutorialsinhand.com

About the Author
Sonu Pandit
Technology geek, loves to write and share knowledge with the world. Having 10+ years of IT experience. B.Tech in Computer Science & Engineering
Page Views :    Published Date : Aug 22,2020  
Please Share this page

Related Articles

Like every other website we use cookies. By using our site you acknowledge that you have read and understand our Cookie Policy, Privacy Policy, and our Terms of Service. Learn more Got it!