What is an applet in Java?

A Java applet is a small Java program that runs inside a web page or browser-like environment and is meant to add interactivity, such as graphics or simple animations.

Quick Scoop

  • Applets are typically embedded in HTML using tags like applet or object.
  • They run on the client side, meaning on the user’s machine rather than on the server.
  • Common applet lifecycle methods include init(), start(), paint(Graphics g), stop(), and destroy().

In simple words

Think of an applet as a tiny Java component that was designed to make web pages more interactive, especially in older Java-based web apps. It could display text, draw shapes, handle mouse clicks, or animate content inside a page.

Important note

Java applets are now largely obsolete because modern browsers no longer support them well, and developers usually use HTML5, JavaScript, or JavaFX instead.

If you want, I can also show:

  • a simple applet example,
  • the applet life cycle,
  • or the difference between an applet and a Java application.