Answer : An interface is a description of a set of methods that conforming implementing classes must have.
Note:
- You can’t mark an interface as final.
- Interface variables must be static.
- An Interface cannot extend anything but another interfaces.
- \
Question : Can we declare a Instance Variable in an Interface ?
Answer : NO , All variables in Interface is public static final implicitly and Explicitly.
Example :
public Interface myInterface
{
int i = 50; /* looks like a instance variable but not */
}
The actual Implementation of above code is
public Interface myInterface
{
public static final int i = 50;
}
Look into Following wonderful link :
- Question :
No comments:
Post a Comment