This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes may be a dumb question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "may be a dumb question" Watch "may be a dumb question" New topic
Author

may be a dumb question

chintan ramavat
Ranch Hand

Joined: Sep 15, 2006
Posts: 134
i am chintan ramavat,
quick question,

i know the characteristic of abstract class and abstract method but i dont know what's the use of abtract method ? abstract class is totally fine that we use them for polymorphic purpose but, dont know abt abstarct method ?

Thank you ranchers
have a nice day
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

An abstract method is used when you want to force a child class to implement a method, and/or there's no sensible default implementation for a polymorphic method. In the classic "Shape" example, whre you have a "Shape" class and subclasses like "Circle" and "Square", you'd make "draw()" an abstract method, since there's no sensible default way to draw a Shape without knowing what kind of shape it is.


[Jess in Action][AskingGoodQuestions]
chintan ramavat
Ranch Hand

Joined: Sep 15, 2006
Posts: 134
so if i m not mistaken, super class forces -> sub classes to implement abstarct method not just to override them.
 
wood burning stoves
 
subject: may be a dumb question
 
Similar Threads
abstract class
overriding an abstract method
the difference of a method as void and not void concern a abstrct method.
Regarding abstarct classes
Abstract Class