It is one of the frequently asked Java questions from beginners which struggles to get the concept behind an interface. The main difference between a class and an interface lies in their usage and capabilities. An interface is the purest form of abstraction available in Java where you just define the API or contract e.g. you define run() method on the Runnable interface without worrying about how something will run, that is left to the implementor which will use a class to define how exactly to run. So an interface gives you method name but how the behavior of that method is come from the class which implements it. That's your general difference between an interface and class in Java and applicable to all object oriented programming language, not just Java. Even though this question is not exactly the difference between abstract class and interface, it's somewhat related to it because an abstract class is nothing but a class with some abstract method. The points I have discussed there, also applicable here in terms of rules of Java programming related to class and interface.
Read more »
