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 run time allocation?
What a static class can contains?
Does substring start with 0?
Does string isempty check for null?
What is a parameter in matrices?
How do you compare values in java?
Is set sorted in java?
What does t in java mean?
What does java edition mean?
What makes a function well defined?
What is the purpose of a default constructor?
What is the file type?
Explain the difference between string, stringbuffer and stringbuilder in java?
Which is best ide for java?
What is main string [] args?