Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can a non-abstract class be extended (inherited from) in Java?

Does the class need to have the abstract keyword before it? Or Does it need to have unimplemented (abstract) methods? Can any normal class be extended?

like image 802
Nitin Garg Avatar asked Mar 06 '12 13:03

Nitin Garg


1 Answers

Yes, all methods which are not final (static is also a bit different form the rest), can be overridden, unless the class itself is declared final. Abstract methods are only used if you do not provide any implementation in the base class.

like image 73
Michał Kosmulski Avatar answered Nov 13 '22 09:11

Michał Kosmulski