Difference Between Applet and Servlet


Applets are small java programs that are primarily used in internet computing. It can be transported over the internet from one computer to another and run using the Applet Viewer or any web browser that supports Java.


Servlets are a small program that executes on the server-side on the web application.

Applet vs Servlet:

1. Applet is a client-side programming.1. Servlet is a server-side programming.
2. Lifecycle methods of an applet are init(), start(), paint(), stop() and destroy().2. Lifecycle methods of a servlet are init( ), service( ), and destroy( ).
3. Applet is required user interface Such as AWT and Swing.3. No user interface is required here.
4. Applet uses parent packages:
import java.applet.*;
import java.awt.*;

4. Servlet uses parent packages:
import javax.servlet.*;
import java.servlet.http.*;
5. It requires more bandwidth for execution.5. It requires less bandwidth for execution.
6. It uses the resources of the client to produce Graphical Interface 6. It uses the resources of the server to process request and response of the client.
7. Applets are less secure as its execution.7. Servlets are more secure as its execution.