• Post Reply Bookmark Topic Watch Topic
  • New Topic

Abstract?  RSS feed

 
Patel Mahesh
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can Abstract Class Be instantiated ? If No Why? So Why does Abstract Class has Non Abstract Methods ? How to use NonAbstract Methods? If abstract class can be instantiated ?How ?



Help Me Someone To Get Rid of This Question .They are Hunting me Badly
 
fred rosenberger
lowercase baba
Bartender
Posts: 12565
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can Abstract Class Be instantiated ?

What happened when you tried it?

You're generally going to get a better response here if you make some effort to answer the question yourself first. I.e. try it, see what happens. Then say "when I did THIS, I expected THAT, but got SOMETHING ELSE."

What would happen if you instantiated an abstract class and called the method that wasn't implemented? What do you think would (or should) happen?
 
Ivan Jozsef Balazs
Rancher
Posts: 999
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
fred rosenberger wrote:
What would happen if you instantiated an abstract class and called the method that wasn't implemented? What do you think would (or should) happen?


Segmentation fault
 
Patel Mahesh
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks fred, i read ,tried and result is abstract class can't be instantiated so why there are non abstract methods how to call them ?is Overriding the answer
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66307
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Abstract methods are to be implemented by the extending class. Non-abstract methods are for the use of the extending class.
 
manish ghildiyal
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Non-abstract methods in abstract class can have a concrete behaviour which class creator may want to be exhibited by all
the extending classes in exactly same manner OR it can have a geenric behaviour which class creator may want to be made more specific by
extending classes.

Manish
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!