SUBJECT MATERIAL, EBOOKS, IMPORTANT QUESTION , ASSIGNMENT QUESTION, OLD QUESTION PAPER

Sunday 6 August 2017

Java Applets and Applications

FEATURE APPLICATION APPLET main() method Present Not present Execution Requires JRE ... thumbnail 1 summary

Image result for Java Applets vs Applications architecture
FEATURE
APPLICATION
APPLET
main() method
Present
Not present
Execution
Requires JRE
Requires a browser like Chrome
Nature
Called as stand-alone application as application can be executed from command prompt
Requires some third party tool help like a browser to execute
Restrictions
Can access any data or software available on the system
cannot access any thing on the system except browser’s services
Security
Does not require any security
Requires highest security for the system as they are untrusted
Size of Program
Large Program
Small Program
Requirement
Need JDK, JRE, JVM installed on client machine.
Applet is portable and can be executed by any JAVA supported browser.
Access
Application can access all the resources of the computer
Applet applications are executed in a Restricted Environment
Program Creation
Applications are created by writing public static void main(String[] s) method.
Applets are created by extending the java.applet.Applet
Start Point
Application has a single start point which is main method
Applet application has 5 methods which will be automatically invoked on occurance of specific event
Program Structure


import java.awt.*;
import java.applet.*;

public class Myclass extends Applet 
{
    public void init() { }
    public void start() { }
    public void stop() {}
    public void destroy() {}
    public void paint(Graphics g) {}
}



public class MyClass
{
public static void main(String args[]) {}
}   


Advantages of Applets of Applets Vs Applications
  1. Execution of applets is easy in a Web browser and does not require any installation or deployment procedure in realtime programming (where as servlets require).

  2. Writing and displaying (just opening in a browser) graphics and animations is easier than applications.
  3. In GUI development, constructor, size of frame, window closing code etc. are not required (but are required in applications).
Restrictions of Applets of Applets Vs Applications
  1. Applets are required separate compilation before opening in a browser.
  2. In realtime environment, the bytecode of applet is to be downloaded from the server to the client machine.
  3. Applets are treated as untrusted (as they were developed by unknown people and placed on unknown servers whose trustworthiness is not guaranteed) and for this reason they are not allowed, as a security measure, to access any system resources like file system etc. available on the client system.
  4. Extra Code is required to communicate between applets using AppletContext.