Friday, August 6, 2010

Inner Classes: Tour.java

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



Which, inserted independently at line 6, compile and produce the output “spooky”? (Choose all that apply.)


A. Sanctum s = c.new Sanctum();
B. c.Sanctum s = c.new Sanctum();
C. c.Sanctum s = Cathedral.new Sanctum();
D. Cathedral.Sanctum s = c.new Sanctum();
E. Cathedral.Sanctum s = Cathedral.new Sanctum();


Option D is the correct syntax to instantiate inner class Sanctum.

No comments:

Post a Comment