• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Abstract?

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
lowercase baba
Posts: 13089
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Rancher
Posts: 1044
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
reply
    Bookmark Topic Watch Topic
  • New Topic