Student implements an interface with name Comparable.So it has to implement,thus write body of every single function of the interface.If one or more functions of the interface is left without an implementation,then the class that implements the interface has to be abstract.What i am saying in code is like this
package airplane;
public interface AirplaneInterface {
void print(String runway);
void setEngines(boolean on);
void setGears(boolean down);
}
and i have another file
package airplane;
public class AirplaneSuperclass implements AirplaneInterface {
//fields
private boolean[] enginesIdle;
private short enginesNumber;
private int altitude;
private String state;//taxiing,landing etc.
private String flightNo;
private boolean gearDown;
private String type;
//methods
void print(String runway)
{
//body
}
void setEngines(boolean on)
{
//body
}
void setGears(boolean down)
{
//body
}
everything ok.
Now if function setEngines was not implemented(had a body) then i would get the error
java.lang.RuntimeException: Uncompilable source code - airplane.AirplaneSuperclass is not abstract and does not override abstract method setEngines (boolean on) in airplane.AirplaneInterface
at airplane.AirplaneSuperclass.<clinit>(AirplaneSuperclass.java:4)