Taken from Sun e-Practice
SCJP Java 5 Mock Exam
What is the result?
A. elm elm elm elm
B. tree elm elm elm
C. tree elm tree elm
D. tree elm elm tree
E. Compilation fails.
F. An exception is thrown at runtime.
Answer : Option D is correct. These are all valid ways to access the type and supertype's static variables.
The part which puzzles me is the "(new Elm().getTree());" part, why does it return the
String "tree" instead of "elm" ? Since the object refers to Elm, and should take Elm's variable.
Thanks for any feedback ranchers!