Interface Fully Abstract methods.
public interface Car {
void go();
void stop();
}
public class Honda implements Car{
@Override
public void go() {
System.out.println("Implemented go method");
}
@Override
public void stop() {
System.out.println("Implemented stop method");
}
}
public class Test {
public static void main(String[] args) {
Honda h = new Honda();
h.go();
h.stop();
}
}
An interface is a contract whereas Abstract method contains partial implementation.
An interface is by default public abstract method.
Variable in interface is public static final and should be initialized.
cannot define blocks and constructor.
Top comments (0)