why not create the object of abstract class. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

why not create the object of abstract class.

Question:

31st Aug 2017, 6:29 PM
P∆WAN M∆URY∆
P∆WAN M∆URY∆ - avatar
4 Answers
+ 11
Then it's not abstract anymore.
31st Aug 2017, 6:52 PM
Tashi N
Tashi N - avatar
+ 11
That is what makes it an abstract class: you cannot create objects of it. If you could the abstract class wouldn't be abstract anymore. You can extend an abstract class. This might help you to learn more: https://docs.oracle.com/javase/tutorial/java/IandI/abstract.html
31st Aug 2017, 7:03 PM
Tashi N
Tashi N - avatar
+ 3
mean?
31st Aug 2017, 6:59 PM
P∆WAN M∆URY∆
P∆WAN M∆URY∆ - avatar
0
It's for the same reason that you can't create object from interfaces. Abstract methods will have some abstract methods without an implementation, so you can't use them, otherwise your code wouldn't know what to do with it since it doesn't have a code te execute.
31st Aug 2017, 8:23 PM
Mark Van Wijk
Mark Van Wijk - avatar