Compiling Practice

This assignment is designed to give you practice compiling and running a Java program. Start by saving the following file to your CompSci folder.

(You can save the file by right-clicking and choosing "Save Target As..." from the context menu.)

Then open up a command prompt.

Compile the program with the "javac" utility and then run the bytecode file through the "java" interpreter to execute it, as shown below.

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\>u:

U:\>cd My Documents

U:\My Documents>cd CompSci

U:\My Documents\CompSci>dir *.java

 Volume in drive U is DATA01
 Volume Serial Number is E012-345E

 Directory of U:\My Documents\CompSci\

08/31/2011  12:40a               1,450 SineWave.java
               1 File(s)          1,450 bytes
               0 Dir(s)  53,887,197,184 bytes free

U:\My Documents\CompSci>javac SineWave.java

U:\My Documents\CompSci>dir SineWave.*

 Volume in drive U is DATA01
 Volume Serial Number is E012-345E

 Directory of U:\My Documents\CompSci\

08/31/2011  12:45a                 416 SineWave.class
08/31/2011  12:40a               1,450 SineWave.java
               2 File(s)          1,866 bytes
               0 Dir(s)  53,887,183,031 bytes free

U:\My Documents\CompSci>java SineWave

U:\My Documents\CompSci>



©2013 Graham Mitchell

This assignment is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.
Creative Commons License