Is abstract classes are necessary when there is an option called interface is available in java? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Is abstract classes are necessary when there is an option called interface is available in java?

26th Jul 2018, 3:59 AM
viki
viki - avatar
2 Answers
+ 1
Yes. Both interfaces and abstract classes cannot be instantiated themselves and needs a class that is extended by them. The difference is that a class may inherit from only one abstract class, but may use multiple interfaces.
26th Jul 2018, 4:44 AM
Udi Finkelstein
Udi Finkelstein - avatar
0
You use them according to your needs. Read more about what is the difference between them and you will know
26th Jul 2018, 4:41 AM
Lstiti