eBay Interview Question: What is the difference betwee... | Glassdoor

Interview Question

QE Engineer Interview

What is the difference between abstract class and interface?


Interview Answer

1 Answer


An abstract class can have instance methods that implement a default behavior. An Interface can only declare constants and instance methods, but cannot implement default behavior and all methods are implicitly abstract.
2. An interface has all public members and no implementation. An abstract class is a class which may have the usual flavors of class members (private, protected, etc.), but has some abstract methods.
3. A class can extend only one abstract class but implement any number of interfaces.

Akila on Jan 25, 2011

Add Answers or Comments

To comment on this, Sign In or Sign Up.