Java Applet vs Application
The java language can be used to create Applet and Application. But there are many differences between applet and application in java.
Following difference shows how the applets are different from real application program.
Sr no. |
Applet |
Application |
1. |
Applet is not fully-featured application program. |
Application is fully-featured program. |
2. |
Applet is written to perform a small task. |
Application is written to perform a particular task which can be large or small. |
3. |
Applet is mostly used to run on the internet. |
Application is designed to run on internet as well as on local computer. |
4. |
Applet do not have main() method like java program. They starts automatically by using their own methods. |
Application uses main() method because they are real java applications. |
5. |
Applet cannot run freely.They are designed to run on HTML page. |
Application can run freely because they are stand alone applications |
6. |
Applet cannot read or write the local computer files. |
Application can read or write the local computer files directly. |
7. |
Applet cannot interconnect with other servers |
Application can interconnect with other servers. |
Applet Example
Displaying message using applet
import java.awt.*;
import java.applet.*;
/*<applet code="Test.class" width=300 height=300> </applet>*/
public class Test extends Applet
{
public void paint(Graphics g)
{
g.drawString("Hello. I'm Applet", 11, 100);
}
}
Output
Application Example
Displaying message using Application
class Test
{
public static void main(String args[])
{
System.out.println("Hello. I'm Application");
}
}
Output