aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Interface variable initialization Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Interface variable initialization" Watch "Interface variable initialization" New topic
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Interface variable initialization