Difference between abstract class and interface in Java is one of the tricky Java interview question and mostly appear in core Java interviews. Both interface and abstract class is a way to achieve abstraction in Java but there are significant difference between both of them. some time interviewer also not just focus on key differences between abstract class and interface in Java but also interested in When to use interface in Java and When to use abstract class is Java, This is a tricky pat of this interview question and you must have good understanding of What is interface and abstract class in Java and How to use them. Anyway in this Java article we will first see some syntactical difference between interface and abstract class in Java programming language and later we will see where to use abstract class and interface
Abstract class vs interface in Java
1) First and major difference between abstract class and interface is that, abstract class is a class while interface is a interface, means by extending abstract class you can not extend another class because Java does not support multiple inheritance but you can implement multiple inheritance in Java.
2) Second difference between interface and abstract class in Java is that you can not create non abstract method in interface, every method in interface is by default abstract, but you can create non abstract method in abstract class. Even a class which doesn't contain any abstract method can be abstract by using abstract keyword.
3) Third difference between abstract class and interface in Java is that abstract class are slightly faster than interface because interface involves a search before calling any overridden method in Java. This is not a significant difference in most of cases but if you are writing a time critical application than you may not want to leave any stone unturned.
4) Fourth difference between abstract class vs interface in Java is that, interface are better suited for Type declaration and abstract class is more suited for code reuse and evolution perspective.
5) Another notable difference between interface and abstract class is that when you add a new method in existing interface it breaks all its implementation and you need to provide an implementation in all clients which is not good. By using abstract class you can provide default implementation in super class.
That's all on difference between abstract class and interface in Java, I will add more differences whenever I learn new things.