Object class of 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
分享
二维码
< <上一篇
下一篇>>