Chapter 6

Using the Object and Class Classes


check Using the toString method

check Implementing the equals method

check Trying out the clone method

check Understanding the Class class

In this chapter, you find out how to use two classes of the Java API that are important to object-oriented programming:

  • The Object class, which every other class inherits — including all the classes in the Java API and any classes you create yourself
  • The Class class, which is used to get information about an object’s type

technicalstuff If I could, I’d plant a huge Technical Stuff icon on this entire chapter. All this stuff is a bit on the technical side, and many Java programmers get by for years without understanding or using it. Still, I recommend that you read this chapter carefully. Even if it all doesn’t sink in, it may help explain why some things in Java don’t work quite the way you think they should, and the information in this chapter may someday help you program your way out of a difficult corner.

The Mother ...

Get Java All-in-One For Dummies, 5th Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.