Difference between Application and Applet in java ?

  • Application and Applet in java are given below:
  • The Difference between application and applet in java  are as follows..

application and applet in java

  • Application Applet
    1.An application is a program that run on computer system under the control of operating system.  1.Applet programs are the internet based programs which can run in a web browser.
     2.Application program contain main() method.  2.Applet does not contain any main() method,but they
    contains different mechanism such as, for initialized
    init() method is used ,to start start() method is used , to stopped
    stop() method or destroy() method is used.
     3.Application program contain Parameterized Constructor.  3. Applet does not contain any Parameterized Constructor.
     4.An application program does not require web browser or applet viewer to run the program.  4.Applet program requires web browser or
    applet veiwer to run the program.
     5. An application programs are executed from Command prompt.  5.An applet programs are executed from a web browser.
     6.An application programs are stand alone written using high level Languages such as C or C++.  6.In order to run an applet, Applet program need to be embedded with another program such as HTML.
     7. System.out.println() method is used to display output on screen.  7.drawstring() method is used to display output on screen.
     8.An application program requires Java virtual machine (JVM) or interpreter to run.  8. An Applet does not require  Java virtual machine (JVM) or interpreter to run.
     9.Application start its execution after main() method.  9.Applet start its execution after init() method.
     10.The application program are used to develop application.  10.Applet are used for creating dynamic and interactive web application.
     11. Application does not  contain higher  security.  11. Applet contain more security that disallow certain operations.
     12.Application program does not require any HTML code.  12.Applet requires HTML code.
     13.Application program does not contain any destroy() method to destroy any application.  13.Applet contain destroy() method to destroy an application.
     14. Appliction run programs from Local system.  14. Applet does not run programs from Local system.
     15.Application program access all resources that are available on the system.  15.Only browser specific resources are accessible.
     16.Example:

    public class classname(Abc)

    {

    public static void main(String args[])

    {

    System.out.println(“Welcome!!”);

    }

    }

     16.Example:

    import java.awt.*;

    import java.applet.*;

    public class Applet1 extends Applet

    {

    public void paint(Graphic g)

    {

    g,drawString(“Welcome”,50,50);

    }

    }

    HTML code:

    <appletcode=”Applet1″, height=”300″,width=”300″>

     17.To Compile:

    javac classname(Abc).java

    17. To compile:

    javac Applet1.java

    18. To run :

    java Classname(Abc)

     18.To run:

    appletviewer Applet1.html

    Read More:

    difference between class and objects in java?

Leave a Comment