A “Hello, World” Applet

Posted By on October 10, 2014


Download PDF
Life Cycle of an Applet
The Applet CLASS

The following is a simple applet named HelloWorldApplet.java:

import java.applet.*;
import java.awt.*;

public class HelloWorldApplet extends Applet
{
   public void paint (Graphics g)
   {
      g.drawString ("Hello World", 25, 50);
   }
}

These import statements bring the classes into the scope of our applet class:

  • java.applet.Applet.
  • java.awt.Graphics.

Without those import statements, the Java compiler would not recognize the classes Applet and Graphics, which the applet class refers to.

Life Cycle of an Applet
The Applet CLASS

Download PDF

Posted by Akash Kurup

Founder and C.E.O, World4Engineers Educationist and Entrepreneur by passion. Orator and blogger by hobby

Website: http://world4engineers.com