Object class is the fundamental class of all Java classes.
If the extends keyword is not used in the class declaration to specify the base class, the base class is the Object class by default.
The Object class defines the public String toSting () method. Its return value is of the String type, which describes the information about the current Object.
When you connect a String to other types of data (for example, System. out. println ("info" + person), The toString () method of the object is automatically called.
You can rewrite the toString () method in the User-Defined type as needed.
Object Transformation
A base class's reference type variable can "point to" its subclass object
The reference of a base class cannot access the newly added member (attributes and methods) of its subclass object)
You can use the reference variable instanceof class name to determine whether the object to which the referenced variable "points" belongs to this class or its subclass.
Subclass objects can be used as base class objects, which are called upcasting, and vice versa)