Help coderanch get a
new server
by contributing to the fundraiser
  • 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 ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin


Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

i have a question here.

if a calss is abstarct, then the class that extends the abstract class should implemnt all the methds. or the class itself should be declared as abstarct.

how come this program compiles and generates an ouput?
here class is abstarct, public void another() is also considered as abstract? is that so. eventhough not declared as abstract. cos class is abstarct. n only MYFUNC IS THE OUTPUT HOW?

unable to understand this anyone please explain it.

Edited by Corey McGlone: Fixed misspelled subject and added CODE tags.
[ May 28, 2004: Message edited by: Corey McGlone ]
Ranch Hand
Posts: 3271
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
An abstract class can define both abstract and non-abstract methods. Any subclass of an abstract class must either implement all of the abstract methods defined in the superclass or it must also be declared as abstract. There is no need for the subclass to override the non-abstract classes in the parent class.

In this example, the subclass does define a body for the one and only abstract method. There is no requirement to override the other method.
A magnificient life is loaded with tough challenges. En garde tiny ad:
We need your help - Coderanch server fundraiser
    Bookmark Topic Watch Topic
  • New Topic