Am i correct? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Am i correct?

Abstract class - A class that can abstract many thing. interface - Also a Abstract class,but in invisible way, unrevealed.

25th Mar 2019, 3:31 PM
Tzion
Tzion - avatar
1 Answer
+ 23
They are quite similar, but there are subtle differences between them, for example a class can extend only one abstract class, while it can implement multiple interfaces, an interface can also extend other interfaces (it is not restricted to only one, as well). I believe that interfaces can't change the access modifiers of their variables (which are always public static final) and methods (which are always public abstract) while an abstract class has more freedom here.
25th Mar 2019, 4:12 PM
1Lory☕
1Lory☕ - avatar