O'Reilly logo

Programmer's Guide to Java™ Certification, A: A Comprehensive Primer, Second Edition by Rolf W. Rasmussen, Khalid A. Mughal

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

Review Questions

2.10 What will be the result of attempting to compile this class?
import java.util.*;

package com.acme.toolkit;

public class AClass {
    public Other anInstance;
}
class Other {
    int value;
}

Select the one correct answer.

  1. The class will fail to compile, since the class Other has not yet been declared when referenced in class AClass.

  2. The class will fail to compile, since import statements must never be at the very top of a file.

  3. The class will fail to compile, since the package declaration can never occur after an import statement.

  4. The class will fail to compile, since the class Other must be defined in a file called Other.java.

  5. The ...

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