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 / ramakrishna
generally if we want to access the variables(non-static)
which are present in the class we use the reference of that
class. we get the reference of the class after creation of
the object. but we can not able to create the object of the
interface if we define the non-static variables inside the
interface if we want to access it is not possible so if we
want to define the variables we should have to define the
variables as static.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is the difference between path and classpath variables?
What is mvc in java?
What is the final keyword?
What is try-with-resources in java?
What is the public field modifier?
What are the six ways to use this keyword?
Which package is imported by default?
Explain about serializable interface in java?
placement papaers of spring computing technology
What is command line argument in java?
What is qualitative variable?
Why java is considered as platform independent?
What is difference between iterator and enumeration in java?
What are memory tables?
What does split function do in java?