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 can you retrive information from database by using hashmap/arraylist ,plz explain with example briefly?
What are 5 boolean operators?
what us Dyna action form?
4 Answers Aithent Technologies,
What is widening and narrowing in java? Discuss with an example.
Explain with example the concept of constant variable in java.
Will set allow duplicates in java?
What is the difference between a constructor and a method?
how to create multithreaded program? Explain different ways of using thread? When a thread is created and started, what is its initial state? : Java thread
Is space a string in java?
Write a method to check if input string is palindrome?
Whats the difference between notify() and notifyall()?
What are abstract methods in java?