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
what do you mean by java annotations?
Is a method a procedure?
What is sorting in java?
Is integer immutable in java?
What is the functionality of the stub?
How can we create a synchronized collection from given collection?
What are advantages of using Java?s layout managers than windowing systems?
What are the two environment variables that must be set in order to run any java programs?
How many bits are used to represent unicode, ascii, utf-16, and utf-8 characters in java programming?
What does indexof return in java?
Why java is object oriented?
Is integer passed by reference in java?
What are the types of sockets in java?
What is difference between checked and unchecked exception in java?
What is an infinite loop in java? Explain with an example.