3.18 Exercises, Problems, and Projects

3.18.1 Multiple Choice Exercises

  1.   1. If you want to use an existing class from the Java Class Library in your program, what keyword should you use?

    • use

    • import

    • export

    • include

  2.   2. A constructor has the same name as the class name.

    • ❑ true

    • ❑ false

  3.   3. A given class can have more than one constructor.

    • ❑ true

    • ❑ false

  4.   4. What is the keyword used to instantiate an object in Java?

    • make

    • construct

    • new

    • static

  5.   5. In a given class named Quiz, there can be only one method with the name Quiz.

    • ❑ true

    • ❑ false

  6.   6. A static method is

    • ❑ a class method.

    • ❑ an instance method.

  7.   7. In the Quiz class, the foo method has the following API:

    public static double foo( 

Get Java Illuminated, 5th 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.