If we run an unextended abstract class will it throw an error? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

If we run an unextended abstract class will it throw an error?

public abstract class Customer { private string name; public Customer (String name){ this.name = name; } public String getName(){ return name; } public abstract void buy(); }

22nd Jun 2018, 2:01 PM
Bijit Biswas
Bijit Biswas - avatar
4 Answers
+ 2
if the given code does not give error by compiler.. related to abstract class. jvm only run psvm() only so give code is compile and execute without doing anything.. .
22nd Jun 2018, 2:49 PM
Arun Tomar
Arun Tomar - avatar
+ 1
this is a challenge question so what's main problem...
22nd Jun 2018, 2:53 PM
Nitish kumar jha
Nitish kumar jha - avatar
+ 1
You can't create instance of abstract class, so as long as there's no "new Customer()" it should work.
23rd Jun 2018, 3:51 AM
BlazingMagpie
BlazingMagpie - avatar
0
yes it was a challenge question . I think we can not run an abstract class. While the code compiles fine. Am I right?
22nd Jun 2018, 3:17 PM
Bijit Biswas
Bijit Biswas - avatar