is it mandatory to deaclare all variables public static
fianl in interfaces?if i declare like in the below program,
public interface A
{
public static final int I=0;
int j=0;
}
in interface A,what is the difference between I,j?
Answer Posted / sreedhar a
As per interface definition all the member variables by
default are public static final. There is no difference
between I and j variables. JVM will consider the j variable
as public static final int j=0;
Note: variables declared in interface must be initialized
otherwise program will fail to compile.
| Is This Answer Correct ? | 7 Yes | 0 No |
Post New Answer View All Answers
When we serialize an object does the serialization mechanism saves its references too?
Is void a wrapper class?
What is the function of static in java?
What does snprintf return?
When does an object becomes eligible for garbage collection in java?
How many types of array are there?
What is string and its types?
Are arrays classes in java?
Why java is called not pure object oriented language?
What is function and its uses?
What is constructor and virtual function? Can we call a virtual function in a constructor?
what is the constructor and how many types of constructors are used in java?
Explain polymorphism citing an example.
What is flag in python?
What does flag mean in java?