Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Programming language is JAVA: Suppose that the class which contains main() is ca

ID: 3830758 • Letter: P

Question

Programming language is JAVA:

Suppose that the class which contains main() is called MyProgram.

What is file name (including extension) of the the source code ?

What command would you enter to compile MyProgram into bytecode? (Assume your source file is in the current directory.)

What command would you enter to run MyProgram from the command line?

Suppose that MyProgram were an Applet rather than an application. Describe the process by which MyProgram can be run from the command line as an Applet.

Explanation / Answer

What is file name (including extension) of the the source code ?

MyProgram.java

What command would you enter to compile MyProgram into bytecode? (Assume your source file is in the current directory.)

javac MyProgram.java

What command would you enter to run MyProgram from the command line?

java MyProgram

Suppose that MyProgram were an Applet rather than an application. Describe the process by which MyProgram can be run from the command line as an Applet.

We need to create an HTML file (MyProgram.html) with

normal html and

<applet code="MyProgram.class" width=300 height=200>

</applet>

then run using

appletviewer MyProgram.html