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
List primitive java types?
What is the maximum size of byte array in java?
Can a serialized object be transferred via network?
What are the types of arrays in java?
What is difference between classpath and path variables in java?
What are different access specifiers in java? Explain
Can you sort a string in java?
Explain about the interpreter in java?
Is null in java?
Which oo concept is achieved by using overloading and overriding?
What are the types of methodology?
What is difference between wait and notify in java?
Explain about doubly linked list
Why do we need hashset in java?
What is the use of isempty in java?