| Author |
Interface variable initialization
|
Nikhil Bansal
Ranch Hand
Joined: Jan 24, 2005
Posts: 60
|
|
Hi All, I am posting a ques frm the forum itself. interface I{ int i = 1, ii = Main.out("ii", 2);} interface J extends I{ int j = Main.out("j", 3), jj = Main.out("jj", 4);} interface K extends J{ int k = Main.out("k", 5);} public class Main { public static void main(String args[]){ { System.out.println(K.j); } } public static int out(String s, int i) { System.out.println(s + "=" + i); return i; } } I think,in interface the variables must be initialized at thier declaration.But here the code is containing method calls.And also iam not able to understand the output. Please Help Me
|
ban$al
|
 |
Burkhard Hassel
Ranch Hand
Joined: Aug 25, 2006
Posts: 1274
|
|
Hi ranchers, Nikhil Bansal posted Halloween, 2006 06:27 AM
Hi All, I am posting a ques frm the forum itself.
what was so bad in the explanation in this thread? http://www.coderanch.com/t/260017/java-programmer-SCJP/certification/interfaces Yours, Bu.
|
all events occur in real time
|
 |
 |
|
|
subject: Interface variable initialization
|
|
|