Java Lec-36 Object Class.2f1b096
Java Lec-36 Object Class.2f1b096
Java Lecture-36
Topic: Object class
The object class is the parent class of all the classes in Java by default.
Every class of Java is either directly or indirectly inherited from object class.
The object class is beneficial, if you want to refer any object whose type you
don’t know at run-time.
2. equals()
This method checks whether two objects are equal or not.
3. finalize()
This method is called by the garbage collector when object is destroyed
form the memory.
4. getClass ()
Returns the run-time class of an object.
5. toString ()
Returns a string representation of an object.
Course: Java Programming, Info Planet Programming Classes Prepared By: Atul Kabra, 9422279260
Course: Java Programming, Prepared By: Atul Kabra, 9422279260
class Employee
{
int emp_no;
String name;
double salary;
Course: Java Programming, Info Planet Programming Classes Prepared By: Atul Kabra, 9422279260