Friday, August 6, 2010

Static Imports: StatTest.java

Courtesy of SCJP Sun® Certified Programmer for Java™ 6 Study Guide Exam (310-065) (9780071591065)
Chapter 10, Question 1









Which, inserted independently at line 1, compiles? (Choose all that apply.)

A.import static java.lang;
B.import static java.lang.Integer;
C.import static java.lang.Integer.*;
D.import static java.lang.Integer.*_VALUE;
E.import static java.lang.Integer.MAX_VALUE; 

F.None of the above statements are valid import syntax

Options C and E. Line 4 doesn't make use of static imports because it uses the fully qualified name of MAX_VALUE.

No comments:

Post a Comment