The actual code | What it really means¡K |
---|---|
/* A Simple Java Applet NAME: SECTION: ASSIGNMENT: | The /* starts a comment. A comment is a sequence of characters that is ignored by the computer. It is for the people who read the file. |
*/ | The */ ends the comment |
import java.awt.*; import java.applet.Applet; | These import statements make available code from the libraries java.awt.* and java.applet.Applet |
public class Hello extends Applet | Everything in Java is written as a class. This class is named Hello. This line initiates the definition of the Hello class. |
{ | This open brace, "{", marks the beginning of the body of the class Hello. |
public void paint(Graphics g) | This line initiates the definition of a method called paint. |
{ | This open brace marks the beginning of the body of the paint method. |
g.drawString("Welcome to JAVA", 30, 30); | This calls the drawString method, which is part of the Graphics class. The Graphics class (and, therefore, the drawString method) is defined in one of the imported libraries. |
g.drawRect(20, 5, 140, 50); | This calls the drawRect method of the Graphics class. |
} | This close brace, "}", marks the end of the body and definition of the method paint. |
} | This close brace marks the end of the body and definition of the class Hello. |