Sun Java Solaris Communities My SDN Account Join SDN
 
Tutorials & Code Camps

jGuru: Testing the Java Environment with SimpleProgram

 


by jGuru

[Help | API Docs | Short Course| Exercises]

For this exercise you compile and run the first Java application from the course notes, SimpleProgram.java.

There are many different Java development environments, so the exact steps required will be somewhat different across Java IDEs.

Prerequisites

  • None.

Skeleton Code

Tasks

  1. Copy and paste the code for SimpleProgram from the course notes into a file (or use the SimpleProgram.java file above) in a working directory where you will develop programs for this course.

  2. Compile the Java source file SimpleProgram.java.

  3. Execute SimpleProgram.

Where help exists, the task numbers above are linked to the step-by-step help page.

Solution Source

Demonstration

If you execute SimpleProgram from a command line, the output should be similar to the following:

C:\>java SimpleProgram
This is a simple program.

If you execute SimpleProgram from a Java IDE, the output should be similar to the following:

figure

That is, there should be a dialog box that displays program output. This window is from VisualAge for Java.

Next Exercise

Exercises

Short Course

Copyright 1996-2000 jGuru.com. All Rights Reserved.