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

Can mvc be used for desktop applications?

474


What is the difference between first and firstordefault?

420


Define thread?

570


Which class does the remote object has to inherit?

599


What does the dispose method do with the connection object?

528






What is private and shared assembly?

536


Define parsing? Explain how to parse a datetime string?

498


What is an argument in c#?

469


Why do we need to serialize data?

497


What is meant by desktop application?

491


My switch statement works differently! Why?

507


What is the difference between int.parse and int.tryparse methods?

562


What is different between Static Constructor and Private Constructor?

458


How do I unload an assembly?

512


What is a float?

490