Java applet
Step1:
(HelloApplet.java) file name
Code:
import java.awt.*;
import java.applet.*;
public class HelloApplet extends Applet
public void paint(Graphics g)
g.drawString("hello i am leo ",65,35);
Setp2:
compile the java file and then we get the class file
(HelloApplet.html) you save it any file name
Code:
<html>
<head>
<body>
<applet code="HelloApplet.class" width="400" height="200"> //put the correct class file
name
</applet>
</body>
</head>
</html>
Java applet
File directory structure:
Once you compile the HelloApplet.java file we get the class file
Setp3:
1) Don’t set the path directly compile the file.
HelloApplet.class file is created in the directory.
Java applet
Step4:
1) Run the html file
Step5:
Output: