drawString() method is defined in Graphics class, it is used to output a string in an applet.
Whenever the applet requires to redraw its output, it is done by using method paint().
paint() is an abstract method defined in AWT.
AWT stands for Abstract Window Toolkit, it is used by applets to interact with the user.
The volatile modifier tells the compiler that the variable modified by volatile can be changed unexpectedly by other part of the program. Specially used in situations involving multithreading.
instanceof
To implement the method drawString we need first need to define abstract method of AWT that is paint() method. Without paint() method we can not define and use drawString or any Graphic class methods.
the code in pain() method “ g.drawString("A Simple Applet,20,20); draws a applet box of length 20 and width 20.
A Simple Applet