yes we can define a variable in an interface in java.
Chat with our AI personalities
According to a beginner's book on Java, an interface can't have constructors. Also, the interface itself can't contain the method implementation.
No. Interface variables are supposed to be public static final. Interfaces, like abstract classes, cannot be instantiated, so all variables in an interface must be static final ones. They are public because usually interfaces are used throughout an application, and this will ensure versatility.
Java does not have the concept of Reference Variables. We cannot access the memory location where the data is stored in Java.
Runnable interface
At any given point of time you cann't get the address of a variables of java program. This is meant for security purpose only.