Can a variable declared in an interface used by a class without implementing it?
Yes.
public interface Test
{
public int i = 5;
}
public class Interf {
public static void main(String[] args) {
if(Test.i == 1){
System.out.println("hi");
}
else{ System.out.println("idiot");
}
}
}
0 Comments:
Post a Comment
<< Home