example of runnable interface in java
Example 1: how to implement a interface in java
interface methods{
public static hey();
}
class scratch implements methods{
// Required to implement all methods declared in an interface
// Or else the class becomes abstract
public static hey(){
System.out.println("Hey");
}
}
Example 2: how to create an abstract method in java
abstract class Scratch{
// cannot be static
abstract public void hello();
abstract String randNum();
}
interface Other{
//all methods in an interface are abstract
public void bye();
String randDouble();
}