JFrame defines the top-level window including the window title and frame menu. String defines a character string to create the label. JLabel defines a user interface component to display static text. While each class has its own specific purpose, they all work together to create the simple user interface you see here. Inheritance One object-oriented concept that helps objects work together is inheritance.
Inheritance defines relationships among classes in an object-oriented language.
In the Java programming language, all classes descend from java.lang.Object and implement its methods. The following diagram shows the class hierarchy as it descends from java.lang.Object for the classes in the user interface example above. The java.lang.Object methods are also shown because they are inherited and implemented by all of its subclasses, which is every class in the Java API libraries. As you move down the hierarchy, each class adds its own set of class-specific fields and methods to what it inherits from its superclass or superclasses. The java.awt.swing.JFrame class inherits fields and methods from java.awt.Frame , which inherits fields and methods from java.awt.Container , which inherits fields and methods from java.awt.Component , which finally inherits from java.lang.Object , and each subclass adds its own fields and methods as needed.