O'Reilly logo

The Java® Language Specification, Java SE 7 Edition, Fourth Edition by Alex Buckley, Gilad Bracha, Guy Steele, Bill Joy, James Gosling

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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.javajava Test Hello, world.

producing the output:

Hello, world.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required