Decrypting the Inheritance Hierarchy
Each class begins with a section
discussing its inheritance hierarchy. The inheritance hierarchy
lets you know from which classes this class extends.
You can easily see from button's inheritance diagram that it
extends from both Component and Object.
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Button
The benefit of knowing the inheritance hierarchy
is that you will know where to look if the functionality you're after is
not contained in the class you are looking at. For example,
suppose you are interested in changing the color of the button.
You will soon find that there is no color changing method in the
Button class. But you know that Buttons can change color because
you've seen them on the web with other colors. Well, using the inheritance
hierarchy diagram, you would next look to see if Button inherits
its chameleon powers from Component. In fact, it does.
NEXT
Selena Sol contributes to the JavaBoutique's Introduction to Java. Selena currently works for Barclays Capital in London, one of the leading global investment banks in Europe and has worked as a software developer for the National Center for Human Genome research, Microline Software, Neuron Data, and Electric Eye in Singapore. Selena is perhaps best-known for creating the Public Domain Web Script Archive (Extropia) and writing several books on Web Programming (Perl, CGI, Java).
Email: selena@extropia.com
|