G.5. Class Object

As we discussed earlier in this appendix, all classes in Java inherit directly or indirectly from the Object class (package java.lang), so its 11 methods (some are overloaded) are inherited by all other classes. Figure G.12 summarizes Object’s methods. We discuss several Object methods throughout this book (as indicated in Fig. G.12).

Image
Image

Fig. G.12 | Object methods.

Recall from Appendix E that arrays are objects. As a result, like all other objects, arrays inherit the members of class Object. Every array has an overridden clone method that copies the array. However, if the array stores references to objects, the objects are not copied—a shallow copy is performed.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset