It creates an object of the class JFrame and gives the frame a title.
Here is the program again:
import java.awt.*; // import the abstract windowing toolkit import javax.swing.*; // import the Swing classes public class TestFrame1 { // usual application main public static void main ( String[] args ) { JFrame frame = new JFrame("Test Frame 1"); // construct a JFrame object frame.setSize(200,100); // set it to 20 pixels wide by 100 high frame.setVisible( true ); // ask it to become visible on the screen } }
The frame object created by new JFrame()
is a section of main storage in your computer.
It contains lots of information about what should appear on the monitor.
But nothing will appear on the monitor without some additional work.