Revature interview question

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

Interview Answers

Anonymous

10 Dec 2020

An abstract class allows you to create functionality that subclasses can implement or override. An interface only allows you to define functionality, not implement it

8

Anonymous

31 Jul 2021

Abstract classes are similar to interfaces. You cannot instantiate them, and they may contain a mix of methods declared with or without an implementation. However, with abstract classes, you can declare fields that are not static and final, and define public, protected, and private concrete methods. With interfaces, all fields are automatically public, static, and final, and all methods that you declare or define (as default methods) are public. In addition, you can extend only one class, whether or not it is abstract, whereas you can implement any number of interfaces.

1