Difference between Application Program and Applet program in java. There are following differences mentioned by me:
Applet Program
|
Application Program
|
It is a small and light weight program.
|
It may be either small or large.
|
It is used to build dynamic applications.
|
It is used to build both static as well as dynamic application.
|
Applet program run according to their life cycle.
Life Cycle:
1.init( )
2.start( )
3.paint( )
4.stop( )
5.destroy( )
|
Application program run according to procedure.
|
Applet program run in restricted environment.
|
Application program run through Java Runtime environment.
|
It does not have any main( ) method
|
It start from main ( ) method.
|
Applet program must extended from Applet class.
|
Newly created application is not necessary to extended from other
class.
|
Give special permission by the java control panel to run the code in
windows 8
|
Not required.
|
Example :
Import java.awt.*;
Import java.applet.*;
Public class design_applet extends Applet
{
public void init()
{
//Applet initialization
}
Public void start()
{
//start applet
}
Public void paint(Graphics g)
{
g.drawString(“dotprogramming”,50,50);
}
Public void stop()
{
//repaint possible
}
Public void destroy( )
{
//repaint not possible
}
}
|
Example:
Public class application_program
{
Public static void main(String r[])
{
// start programming here
System.oout.println(“dotprogramming”);
}
}
|
Use paint method to display
string
|
Use System.out.println() method to display in it.
|
No comments:
Post a Comment