1. Java® 2 Platform software can be used to create and run three common types of
programs written for the Java platform—applications, applets, and servlets.
A Java application is similar to any other programming language, and can perform all
tasks normally associated with programs, including various tasks that applets cannot
perform. In addition, an application does not need a browser to be executed and
execution is possible in a client or server machine. Java applications are popular and
often seen in applications like accounting software, office suites, graphics software and
media players to name a few.
A Java applet is a small application program and must be downloaded before it is run
within a Java-enabled Web browser. Applets are located on a Web server. When the
Web server returns an HTML page that points to a Java applet, the Java-enabled Web
browser requests the applet to be downloaded from the Web server. Once received, the
browser starts the applet internally, or an external JVM executes it. Applets usually
perform simple operations and are used to provide interactive features to web
applications that cannot be provided by HTML alone. Applets are popular as they can
capture mouse input (like rotating 3D object) and also have controls like buttons or
check boxes. In response to the user action an applet can change the provided graphic
content.
A Java servlet is basically a server-side Java, and runs on the Web server just like and
applet runs in the Web browser. They can be used to extend the functionality of the
Web server. The Web server hands requests to the servlet, and the servlet replies to
them. Servlets can be used instead of CGI applications. To run Java servlets, your Web
server must support the Java servlet API, developed by JavaSoft. This API defines how
the servlet communicates with the server. Java servlets have security advantages over
client-side Java applets. A servlet that runs on a Web server inside a firewall can control
access to sensitive data and business logic. Java applets do not inherently provide
these security capabilities. Java servlets are popular for processing and storing data
submitted by an HTML form, and an online shopping cart system that manages
shopping carts on a retail web site.
So, to summarize, the major qualities of Java are:
• Its similarity to other popular languages
• Its ability to enable Web interaction
• Its ability to enable executable Web content
• Its ability to run on multiple platforms