Object classLearn about Object class in Java Object class is the implicit parent of all classes defined in Java. Object class defines certain behaviour (methods) like toString, equals. For the complete list of methods in Object class please click here As all classes implicitly inherit Object class, any given Java class will inherit these methods. This is a very important design concept which you should remember. We can even assign an Array to an Object. As an example.
public static void main(String[] args) {
int[] runsScored = new int[]{45,120,4,18};
Object objectCanHoldArray=runsScored;
String myCountry="India";
Object countryObject=myCountry;
}
|