What is the difference between an interface and an abstract class?
A) An interface can have state, while an abstract class cannot.
B) An abstract class can have both abstract and concrete methods, while an interface can only have abstract methods.
C) An interface can inherit from a class, while an abstract class cannot.
D) There is no difference; they are the same.
Answer: B) An abstract class can have both abstract and concrete methods, while an interface can only have abstract methods.
Explanation: An abstract class can contain both abstract methods (without implementation) and concrete methods (with implementation), whereas an interface is a contract that only defines method signatures. However, some programming languages allow interfaces to have default methods with implementations. Interfaces do not maintain state (no instance variables), while abstract classes can.