A good answer might be:

  • What should the source file be named for this applet?     AnotherHello.java
  • What file will be created when the source file is compiled?     AnotherHello.class

Compiling Applets

Name the source file (the file you create with NotePad) the same as the object it defines. The compiler will create a file of bytecodes called className.class for every class in the source file.

As far as the compiler is concerned, the soure file for an applet is just another collection of object definitions. It does not matter that one of the objects is an applet. So it does the same things as it does with applications. So to compile the above applet (contained in file AnotherHello.java) using the command-line interface, do this:

C:\> javac AnotherHello.java
This creates AnotherHello.class in your directory.

If you want, you can copy the above source code into NotePad, save it to AnotherHello.java, and compile it. You will not be able to run it in the usual way, however.

QUESTION 7:

Why will

java AnotherHello 
not work to run this applet?

Click Here after you have answered the question