can abstract methods have body? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

can abstract methods have body?

27th Jul 2016, 4:11 AM
Anvitha Sarma
Anvitha Sarma - avatar
4 Answers
0
Abstract methods have no implementation, so no. They are just blank methods used for the extending classes
27th Jul 2016, 4:29 AM
James
James - avatar
0
But I have seen that by using default keyword before abstract method body can be declared
27th Jul 2016, 4:31 AM
Anvitha Sarma
Anvitha Sarma - avatar
0
no.. you can't have a body in it.. abstract means just like headings.. u can have methods..
27th Jul 2016, 4:35 AM
mahi
0
You can't have a body in an abstract method, there's no {} support whatsoever. Abstract methods are defined by the subclass. In those subclasses, the methods can have body.
27th Jul 2016, 4:37 AM
James
James - avatar