You are on page 1of 1

Java Example Program The following two web pages are important.

They contain nearly all of the inform ation a Java programmer might need about the various Java library classes. Main Java Sun Web Page Alphabetical Listing of Java Library Classes (See Java Sun API Specification Page for other versions, etc.) 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 HelloWorld.java HelloDate.java FunctionCall.java Array usage in Java A tutorial on using arrays in java ArrayDemo.java Class Usage in Java Point2d.java Test jig for Point2d class (PointTester.java) Point3d.java I/O and files in Java KeyboardIntegerReader.java KeyboardReader.java MyFileReader.java MyFileReader.txt MyFileWriter.java MyFileWriter.txt

You might also like