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
Why is multiple inheritance not supported in java?
Tell us something about set interface.
What are the differences between the constructors and methods?
Which java version is latest?
Why do we need wrapper classes?
What is void keyword?
Why are the destructors for base class and derived class called in reverse order when the program exits
What is a byte string?
What is the difference between logical data independence and physical data independence?
What is synchronization and why is it important in java programming?
Is set ordered?
What is a newline character in java?
Can you use this() and super() both in a constructor?
What is main string [] args?
Explain method local inner classes ?