java

Download Java

If you can't read please download the document

Upload: crystal-smith

Post on 31-Jan-2016

212 views

Category:

Documents


0 download

TRANSCRIPT

QuestionWhat is the difference between an Applet and an Application?(Applets)AnswerThe differences between an applet and an application are as follows:1. Applets can 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 line by java.exe or jview.exe.3. Applets execute under strict security limitations that disallow certainoperations(sandbox model security) whereas Applications have no inherent securityrestrictions.4. Applets don't have the main() method as in applications. Instead theyoperate on anentirely different mechanism where they are initialized by init(),started bystart(),stoppedby stop() or destroyed by destroy(). QuestionWhat are the Applet's Life Cycle methods? Explain them?(Applets)AnswerFollowing 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 usually 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 moves off the applet's pagedestroy() method - called when the browser is finished with the applet QuestionWhat is the sequence for calling the methods by AWT for applets?(Applets) AnswerWhen an applet begins, the AWT calls the following methods, in thissequence:init()start()paint()