This chapter is from the book
1.2 Example Programs
Most of the example programs given in the text are ready to be executed and are similar in form to:
class Test { public static void main(String[] args) { for (int i = 0; i < args.length; i++) System.out.print(i == 0 ? args[i] : " " + args[i]); System.out.println(); } }
On a machine with the Oracle JDK installed, this class, stored in the file Test.java, can be compiled and executed by giving the commands:
javac Test.java java Test Hello, world.
producing the output:
Hello, world.