Java Classes (review)

Classic programmed-learning exercises, refreshed for modern Java and presented in the current MrStyner.com portfolio style.

Modern Java noteThis archive has been refreshed for Java 25 LTS. Core language concepts remain useful, while outdated setup instructions and browser-era Java are labeled or replaced. Java 26 is the current feature release; Java 25 is used here as the stable teaching baseline.
go to previous page   go to home page   go to next page

Answer:

Yes. You see this when the main window of a browser contains frames, which themselves contain other components.

Java Classes (review)

The component classes that make up the AWT and Swing are related to each other by inheritance. The class that is the ultimate ancestor of all other classes is the class called Object. The class Object defines the basic nature of all Java objects. Much of what goes on behind the scenes when a Java program is running is defined by Object. Part of the Java class hierarchy looks like this:

java class hierarchy

The "clouds" convey the idea that these are class definitions, not objects. The diagram shows that the classes Boolean, Character, Component, String, and many others have Object as a direct ancestor. The cloud for the Component class is dotted to show that it is an abstract class.

QUESTION 9:

(Review: ) Can a child class have methods and variables in addition to those it inherits from its parent?