1.

What Is The Difference Between Java Applets And Applications?

Answer»
  • With Java, you can create two types of programs: an applet or an application. As you have learned, a Java applet is a program that executes from within a Web browser. A Java application, on the other hand, is a program that is independent of the browser and can run as a standalone program.
  • Because an applet is run from within a Web browser, it has the advantage of having an existing vindow and the ability to respond to user interface events provided though the browser. In addition, because applets are designed for network use Java is much restrictive in the types of access that applets can have to your file SYSTEM than it is with non-network applications.
  • As you will, when you write a Java application, you must specify a main METHOD (much like the C/ C++ main), which the program executes when it begins. Within the main method, you specify the FUNCTIONALITY that your application performs. With an applet, on the other hand, you need to write additional methods that respond to events which are an IMPORTANT part of the applet's life cycle. The methods include INIT, start, stop, destroy and paint. Each of these events has a corresponding method and, when the event occurs, Java will call the appropriate method to handle it.
  • When you write your first Java programs, you can write them as if .they were applets and use the appletviewer to execute them. As it turns out, you can later convert your applet to an application by replacing your init method with a main method.



Discussion

No Comment Found