Difference Between Applet and Servlet in Java

In this post, we will understand the difference between applet and a servlet in Java.


  • They are executed on client-side.

  • It runs within a Web browser.

  • It runs on the client machine.

  • Its parent packages are ‘java.applet.*’ and ‘java.awt.*’.

  • Some methods include init(), stop(), paint(), start(), destroy().

  • A user interface is needed to execute an applet.

  • User interface examples are AWT or swing.

  • It requires user interface on client machine to execute the applet.

  • This is done since it needs more bandwidth.

  • They prone to risk since they are executed on the client machine.


  • It is executed on the server-side.

  • It runs on the web Page.

  • It runs on the server.

  • Its parent package includes ‘javax.servlet.*’ and ‘java.servlet.http.*’.

  • Some of the life cycle methods include init(), service(), and destroy().

  • It doesn’t need an interface to execute.

  • Since they are executed on servers, they need less bandwidth.

  • They are more secure in comparison to applet since they are under the security of server.