kenzo testini

Greenhorn
+ Follow
since Mar 10, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by kenzo testini

I see a question about the errata and a question about the exam.
Kedar,
it prints out jj=4 because when the interface constant j is referenced by K.j the interface J's <init thread> resolves all its variables, which are calls to the static method "Test.out"(which happens to have a System.out.println), so any other variable you define with Test.out in an interface you refer to is going to be println'd , too.
Notice that if you call System.out.println(K.i) it will do the equivalent to the interface constants of I.

3 is printed out because that is what your main prints out:
System.out.println(K.j) = System.out.println(Test.out("j",3)
First Test.out calls System.out.println which yields j=3
then it *returns* the int 3, which is printed out by the
System.out.println in your *main* method