What is the definition of an interface?
In the below
test question from JQ+ a Runnable interface is instantiated. I have never seen this before. I thought an interface was to be implemented by a class or extended by a class. What exactly is the definition of an interface?
It is like a class with all the rights of a class?
public class junkf {
public int startHere = 1;
public int endHere = 100;
public static void main(
String args []) {
new junkf().go();
}
void go() {
Runnable a = new Runnable() { //Note the use of Runnable
public void run()
{
for (int i = startHere; i <= endHere; i++) { System.out.println(i); }
}
};
Thread t = new Thread(a);
t.start();
}
}