Java

You might also like

You are on page 1of 1

Question

What is the difference between an Applet and an Application?


(Applets)
Answer
The differences between an applet and an application are as follows:1. Applets c
an be embedded in HTML pages and downloaded over theInternet
whereasApplications have no special support in HTML for embedding ordownloading
.2. Applets can only be executed inside a java compatible container,
such asa browseror appletviewer whereas Applications are executed at command li
ne by java.exe or jview.exe.3. Applets execute under strict security
limitations that disallow certainoperations(sandbox model security) whereas Appl
ications have no inherent securityrestrictions.4. Applets don't have the
main() method as in applications. Instead theyoperate on anentirely different m
echanism where they are initialized by init(),started bystart(),stoppedby
stop() or destroyed by destroy().
Question
What are the Applet's Life Cycle methods? Explain them?
(Applets)
Answer
Following are methods in the life cycle of an Applet:init() method - called when
an applet is first loaded.
This method is calledonly once in the entire cycle of an applet. This method usu
ally intializethe variables to be used in the appletstart() method
- called each time an applet is startedpaint() method - called when the applet
is minimized or refreshed. Thismethod is used for drawing different strings,
figures, and images on theappletwindowstop() method - called when the browser mo
ves off the applets pagedestroy() method - called when the browser is
finished with the applet
Question
What is the sequence for calling the methods by AWT for applets?
(Applets)
Answer
When an applet begins, the AWT calls the following methods, in thissequence:init
()start()paint()

You might also like