Program Conventions

You will probably see some questions that involve the conventions for starting a Java application. The command line to start a Java application consists of the name of the Java interpreter, the name of the starting class (just the name—the .class file type is assumed), and zero or more parameters. The JVM expects to find a method named main with the signature as follows:

public static void main(String[] args )

This method will be the first one executed by the JVM. The command-line parameters are turned into an array of String objects, which is passed to the main method. The array is typically named args, but it could be named anything. For example, the command to run an application named MyApp with a word and two numbers ...

Get Java 2™ Programmer Exam Cram™ 2 (Exam CX-310-035) now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.