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 invokes a threads run() method? : Java thread
Why is string buffer better than string ?
What is the lifetime and scope of a variable?
How to compare strings in java?
What is indexof?
Is there is any difference between a scrollbar and a scrollpane?
How do you input a string in java?
What does java final mean?
Which is the class in java?
Is it possible to use Semaphore/ Mutex in an Interrupt Handler?
how to one war file class to another war file class?
What is the disadvantage of synchronization?
What are design patterns and please explain?
How many techniques can be employed to create a string object?
What does the ‘static’ keyword mean? Is it possible to override private or static method in java?