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
Which containers use a flowlayout as their default layout in java programming?
What is the basic of java?
How to access arraylist elements in java?
I want to persist data of objects for later use. What is the best approach to do so?
how do I create a runnable with inheritance? : Java thread
What is the generic class?
What is difference between == and === in js?
What is difference between ++ I and I ++ in java?
How do you find the maximum number from an array without comparing and sorting?
Why is the main method declared static?
What is default locale java?
Difference between keyword and identifier.
What is natural ordering in java?
What is the length of a string?
What is the importance of main method in Java?