2. Primitive Data Types and Operations

 
[Page 26 ( continued )]

Programming Exercises

1.1 ( Creating, compiling, and running a Java program ) Create a source file containing a Java program. Perform the following steps to compile the program and run it (see §1.9, "Creating, Compiling, and Executing a Java Program"):
1.
Create a file named Welcome.java for Listing 1.1. You can use any editor that will save your file in text format.

2.
Compile the source file.

3.
Run the bytecode.

4.
Replace "Welcome to Java" with "My first program" in the program; save, compile, and run the program. You will see the message "My first program" displayed.

5.
Replace main with Main , and recompile the source code. The compiler returns an error message because the Java program is case-sensitive.

6.
Change it back, and compile the program again.

7.
Instead of the command javac Welcome.java , use javac welcome.java . What happens?

8.
Instead of the command java Welcome , use java Welcome.class . What happens?

 


Introduction to Java Programming-Comprehensive Version
Introduction to Java Programming-Comprehensive Version (6th Edition)
ISBN: B000ONFLUM
EAN: N/A
Year: 2004
Pages: 503

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net