class AbstractDemo {
public void displayData();
}
If you compile this code you will compile time error as
AbstractDemo.java:2: missing method body, or declare abstract
public void displayData();
^
This means
If the method is in a class as opposed to interface then both method and class must be marked abstract
abstract class AbstractDemo {
public abstract void displayData();
}
If you compile this code you will not get any compile time errors.
as opposed to interface
But if the same is a interface like
interface AbstractDemo {
public void displayData();
}
If you compile this code you will not get any compile time errors because the method displayData() is implicitly abstract.