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.
The class will fail to compile, since the class Other has not yet been declared when referenced in class AClass. The class will fail to compile, since import statements must never be at the very top of a file. The class will fail to compile, since the package declaration can never occur after an import statement. The class will fail to compile, since the class Other must be defined in a file called Other.java. The class will fail to compile, since the class Other must be declared public. The class will compile without errors.
|