Object class of Java
•
Java
Object is the parent class of all classes, also known as the base class. If you do not use the extends declaration in the class to inherit which class, you will inherit the object class by default.
Its role:
Output:
This is a subclass of the person class, this is a subclass of the person class, this is a subclass of the student class, this is a subclass of the person class, and this is a subclass of the graduate class
Note: the formal parameter in the test method is an instance of an object object, that is, any object instance can be passed in to the test method.
Main methods in object:
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码