Review Questions

1.8 What command in the Java 2 SDK should be used to compile the following code contained in a file called SmallProg.java?
public class SmallProg {
    public static void main(String[] args) { System.out.println("Good luck!"); }
}

Select the one correct answer.

  1. java SmallProg

  2. javac SmallProg

  3. java SmallProg.java

  4. javac SmallProg.java

  5. java SmallProg main

1.9 What command in the Java 2 SDK should be used to execute the main() method of a class named SmallProg?

Select the one correct answer.

  1. java SmallProg

  2. javac SmallProg

  3. java SmallProg.java

  4. java SmallProg.class

  5. java SmallProg.main()

Get Programmer's Guide to Java™ Certification, A: A Comprehensive Primer, Second Edition 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.