why abstract class does not have object creation
Answers were Sorted based on User's Feedback
Answer / sonykrishna90
bcz of abstract class have abstract methods and concrete methods in that process does n't have method body so how can know the jvm how much memory will allocate for that method so we dont have the creation of object.and another answer is abstract class abstract methods may have or may not also in that JVM was fixed for when abstract key word is coming there no object instantiation.
Is This Answer Correct ? | 20 Yes | 5 No |
"Abstract class has not implemented method so, we cant create the object" "The word 'Abstract' instruct the clr that not to create object of the class"
But in a simple class where we have all virtual method, able to create an object???
Also, we can define different access modified to Abstract class constructor like private, protected or public.
An abstract type is defined largely as one that can't be created. You can create subtypes of it, but not of that type itself. The CLI will not let you do this.
An abstract class has a protected constructor (by default) allowing derived types to initialize it.
Is This Answer Correct ? | 5 Yes | 1 No |
Answer / sushila sonare
if we create an object for abstract class, so through object
reference we can use all method. But in abstract class some
method is abstract, i.e. they don't have body of the method.
At the time of method calling we are getting error. Compiler
don't know what to do. To avoiding this problem its
restricted to create an object
Is This Answer Correct ? | 4 Yes | 1 No |
Answer / nikhil agrawal
Abstract class containing abstract method as well as concrete method(Having body). The purposes of object creation is to call the method.but the class containing incomplete method means abstract method. its not possible to call incomplete method whose body is not defined. that's why Abstract class does not have object creation.
Is This Answer Correct ? | 2 Yes | 1 No |
Answer / ashutoshssolankar
we cant create object of the Abstract class because of the
concrete method have no body but we can create object of
another class by using overriding the method of the Abstract
class in another class.
Is This Answer Correct ? | 2 Yes | 5 No |
Answer / meenakshi
absract class contain defined and undefined methods,,so when we create object for abstract class we need to override both defined and undefined methods inorder to avoid overriding defined methods for abstract class there is no object creation...
Is This Answer Correct ? | 0 Yes | 5 No |
How many arguments can a method have java?
What is close method? How it's different from Finalize & Dispose?
0 Answers InfoAxon Technologies,
what is the difference between a java object reference and c++ pointer?
There are 2 classes, 1 LandAnimal and another WaterAnimal. There is another class Animal which wants to have the properties of both LandAnimal and WaterAnimal. How will you design this situation?
What is the use of parse function in java?
What is garbage collector?
What is merge sort in java?
how you will prevent method overriding?
What is the abstract class?
what is the purpose of the final in the try-catch-final
What is the difference between JDK and JVM?
Tell me how many ways are there to initialise an integer with a constant.