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 is join () in java?
What is the purpose of nested class in java?
What is meant by attribute?
What is a java string?
Can a set contain duplicates?
what is inner class in java?
How do you write a conditional statement?
What are different data types?
What is nullpointerexception in java?
What is the use of singleton class?
What is regex in java?
What is treeset and treemap in java?
What are the different http methods?
Why we use methods in java?
What is static class