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


Please Help Members By Posting Answers For Below Questions

What is .edmx file?

539


How to achieve polymorphism in c#?

547


You have got 1 million parking slots. At a time a parking slot can be free or not. To get next slot easily which data structure to implement?

614


List out two different types of errors in c#?

534


Are c and c# the same thing?

496






What is addressof operator?

526


Explain About friend and Protected friend

526


Explain the difference between a namespace and assembly name in .net?

504


What are the Types of assemblies that can be created in dotnet

663


What is activator c#?

481


What are different types of Delegates in C#?

568


What are native methods?

490


Is std :: string null terminated?

494


What are the advantages of properties in c#?

561


How does dependency injection work c#?

504