A good answer might be:

The paint() method of a JFrame object is used by the Java system when it wants to paint on the monitor screen. It is a mistake for you to call it directly.


Picture of myFrame

The picture for this program is similar to that for the previous program. The class TestFrame2 holds a static main() method which is where the program starts running. Then an object is constructed using the class definition for myFrame. The variable frame refers to this object. Here is a picture of what is going on:

When the system decides to paint on the monitor screen, it first does its work, then at the end calls the paint() method that is part of the myFrame object in main memory. The drawString() method in paint() puts some text on the monitor.

QUESTION 9:

Why not use System.out.println("Some Message")
to put some text on the monitor?