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 |
what is custom tags with example?
How do you sort a string in java?
What is an image buffer?
What are the drawbacks of reflection?
How do you convert boolean to boolean?
why abstract class does not have object creation
What is getclass () getname () in java?
What are the disadvantages of object oriented programming?
What is the program development process?
how to fing linkedlist is circular or not?
Why java strings are immutable in nature?
What is the format specifier?