
- Java Tutorial
- Java - Home
- Java - Overview
- Java - Environment Setup
- Java - Basic Syntax
- Java - Object & Classes
- Java - Constructors
- Java - Basic Datatypes
- Java - Variable Types
- Java - Modifier Types
- Java - Basic Operators
- Java - Loop Control
- Java - Decision Making
- Java - Numbers
- Java - Characters
- Java - Strings
- Java - Arrays
- Java - Date & Time
- Java - Regular Expressions
- Java - Methods
- Java - Files and I/O
- Java - Exceptions
- Java - Inner classes
- Java Object Oriented
- Java - Inheritance
- Java - Overriding
- Java - Polymorphism
- Java - Abstraction
- Java - Encapsulation
- Java - Interfaces
- Java - Packages
- Java Advanced
- Java - Data Structures
- Java - Collections
- Java - Generics
- Java - Serialization
- Java - Networking
- Java - Sending Email
- Java - Multithreading
- Java - Applet Basics
- Java - Documentation
- Java Useful Resources
- Java - Questions and Answers
- Java - Quick Guide
- Java - Useful Resources
- Java - Discussion
- Java - Examples
Difference Between Applet and Servlet in Java
In this post, we will understand the difference between applet and a servlet in Java.
Applet
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.
Servlet
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.
- Related Articles
- Difference between Servlet and JSP
- Difference Between CGI and Servlet
- Difference Between Applet and Application
- What are the differences between an application and an applet in Java?
- Difference between Java and JavaScript.
- Difference between Go and Java.
- Difference Between C++ and Java
- Difference between Groovy and Java
- Difference between ArrayList.clear() and ArrayList.removeAll() in java?
- Difference between Applets and Servlets in Java.
- Difference between ArrayList and HashSet in Java
- Difference between Arrays and Collection in Java
- Difference between concat() and + operator in Java
- Difference between Definition and Declaration in Java.
- Difference between HashMap and HashSet in Java.
