?
What will be the output for the below code?
What will be the output for the below code?
public interface TestInf{
int i =10;
}
public class Test{
public static void main(String... args){
TestInf.i=12;
System.out.println(TestInf.i);
}
}
public interface TestInf{
int i =10;
}
public class Test{
public static void main(String... args){
TestInf.i=12;
System.out.println(TestInf.i);
}
}
Answer & Solution
Correct Answer:
Option
A
All the variables declared in interface is implicitly static and final , therefore can't change the value.
Join the Discussion
Login to post a comment or share your explanation.
Login