Herbert J. Bernstein
yaya@dowling.edu
Run your favorite editor (e.g., Ultra Edit) or word processor (e.g., Microsoft Word). Type in the Java code.
Save the program you've constructed to a text file, Filename.java. NOTE: Remember to name your file with the same identifier as your program or class. That is, if your program begins:
public class MyClass
{......
then, save your program as: MyClass.java. If you use a word processor, be sure to save the program as a text file, NOT as a Word file.
Run the MS-DOS prompt window.
At the prompt, type javac followed by the filename as follows:
>javac Hello.java
This tranlates the Java source code into Java Bytecode. That is, I have created a new file called Hello.class.
>java Hello
Hello World!
The program has been executed.
There are two ways to give me your homework assignments:
(Hard Copy)
Note: as of 6 November 2001, you should make every effort to submit assigments via emailIf you must submit hard copy, you should hand in your source code as well as your output from your program. If you have keyboard input, you should have your program echo the input to the screen so that you can see it on output. For example,
x = Keyboard.readInt ("Number Please");
System.out.println (x); //copies the keyboard input to the screenTo create an output file that you can print, you can invoke your program as follows:
java Program > Program.out
This will send the output from your program to the file Program.out instead of to the screen. This is called "redirection" of output. Then print both Program.java (your source code) and Program.out (your output) and hand them in.
(E-Mail)
Just send me an email message at yaya@dowling.edu including the source code file (Program.java) and output file (Program.out) as part of the text of the message, not as attachments
This page is based on the CSC012N course web page by Bill Steinmetz, Fall 2001. Revised by Herbert J. Bernstein, 4 November 2001.