Java Applet Hello World

      No Comments on Java Applet Hello World
Mobile Apps Category (English)728x90

Java Applet Hello World

Basically using Java Programming Language you can develop desktop like application or website like application. This example demonstrate the use of Java Applet. Java Applet can be executed only in Browser or using appletviewer. Here I have demonstrate to quick start with Java Applet Hello World. Stay Tuned Will be back with more Java Applet Programs.

Did you know, Java Application Vs Java Applet

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

	<applet code="Applet1.class" height="300" width="300"></applet>
public class Applet1 extends Applet 
	private String strDefault = "Hello! Java Applet.";

	public void paint(Graphics g) 
		g.drawString("Java Applet Hello World", 100, 25); 


Unique Functionality in Java Applets

  • Java Applet does not have main method for entry
  • It has init(), start(), stop(), paint() and destroy() method generally.
  • Most of the code is written on paint() method.
  • To run Java Applet Program you need to create html file and have to add applet tag to load applet in that region.

Steps to Run Applet Example

  • Write down Java Code and Compile it using javac command to generate class file.
  • Create HTML File with Applet tag and basic 3 attributes (code,width and height)
  • Make sure that your html file and class file should be in same location to load your class file in browser.
  • Open HTML File in any Browser that supports java runtime.


Your Suggestions/Comments are welcome.

Personal Development Category (English)728x90

Leave a Reply