yes we can define a variable in an interface in java.
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.
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.
NO, we cannot create a contructor for an interface in java.
interface is a list of methods which implements that interface
A tagging interface type in Java is an interface that has not defined methods such as the java.io.Serializable interface.
Java does not have the concept of Reference Variables. We cannot access the memory location where the data is stored in Java.
Runnable interface
Yes. This is a valid interface definition in Java: interface Useless {}
no
An interface in Java is like an abstract class, but there are no method bodies allowed in it and it has to be declared with the interface keyword. It is Java's way of getting around the Deadly Diamond of Death. Only abstract methods and constants are allowed in it.
Global variables are globally accessible. Java does not support globally accessible variables due to following reasons:The global variables breaks the referential transparencyGlobal variables creates collisions in namespac
Interface is collection of abstract methods which has only declaration and no implementation