educative.io

What is the difference between an interface and an abstract class in Java?

The answer given to this, in the course “the-java-interview-handbook-300-interview-questions” is
Members of an abstract class can have varying visibility of private, protected, or public. Whereas, in an interface all methods and constants are public.

However I feel, I could create private default method or private static methods in Interface. Could you elaborate on this as the above answer seems contradictory.

Hey @Aditya4

In previous versions of Java, it was not possible to have private methods in interface but From Java 9, private methods can be added to an interface. For any further query feel free to ask.

Happy learning,