简体   繁体   中英

What is the Object class in Java?

what is or what type is private Object[] obj; ?

Object is the ultimate ancestor of every class in the Java inheritance hierarchy.

From the API:

Class Object is the root of the class hierarchy. Every class has Object as a superclass. All objects, including arrays, implement the methods of this class.


The declaration:

private Object[] obj; 

declares a reference variable called obj for an array of Object s that private to the class that declared it. (Note that this doesn't create this array, only declares a variable capable of referencing it).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM