Can we create instance for Abstract class?
Answer Posted / sudhakarramineni
Yes, but it is not recommended to create an instance
directly for abstract class, it may causes to crash the JVM.
First one thing you want to know is Abstraction. Hiding
unnecessary details to the user and expose the details which
are required to the end user is called abstraction.
Eg: In telephone, dialing a number is an interface and
complex circuit which takes keystrokes of a user and
performs the necessary operation is called it's implementation.
Generally, humans manage complexity through abstraction.
So any complex device can be operated by abstraction, even
though they don't know it's implementation.
Abstract class contains abstract methods and concrete
methods. A method without body is called abstract method
otherwise it 'll be treated as general method.
Solution:
If you want to create an instance for abstract class,
first you create a concrete subclass and create an instance
for that and use it.
| Is This Answer Correct ? | 37 Yes | 13 No |
Post New Answer View All Answers
what is the purpose of using statement in c#
Why is hashset faster?
What is lazy loading and eager loading in c#?
What is a dll in c#?
What is the difference between dynamic and var in c#?
What are extender provider components? Explain how to use an extender provider in the project.
Can class inherit from struct c#?
Can a class or a struct have multiple constructors?
Can you create partial delegates and enumerations?
Why can't we use a static class instead of singleton?
Are there constructors in c sharp?
Why do we use lambda expression in c#?
What does the parsefloat function do?
What is binding in c#?
What is difference between gridview and form view?