Java Example Program
The following two web pages are important. They contain
nearly all of the information a Java programmer might need
about the various Java library classes.
Compiling and running a java program
- To create a Java program, you must ensure that the name of the
class in the file is the same as the name of the file (and that the
file has the extension .java).
- To compile the program use the command javac as in:
javac HelloWorld.java
This will take the source code in the file HelloWorld.java (which
better contain the class HelloWorld)
and create the Java ByteCode in a file HelloWorld.class.
- To run the compiled program use the command java as in:
java HelloWorld
Note that you do not use the any file extension in this command.
Very Simple Java Example Programs
Array usage in Java
Class Usage in Java
I/O and files in Java
Exception examples in Java
On Going Help and Assistance
Contact the UIC Student Chapter of the ACM
for additional help. The ACM Office is in 1309 SEO and you can set up
some tutoring by sending email to
tutor@acm.cs.uic.edu or by going to the
ACM Tutoring Web Page