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 Java 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 "Java" Watch "Java" New topic


Shantanu Puranik
Ranch Hand

Joined: Jun 10, 2004
Posts: 67
In Which situation we should choose Abstract and in which situation we should use Interface

--- Shantanu
Shraddha Jain

Joined: Feb 02, 2006
Posts: 27
if there's something u want every subclass to do exactly the same way and there are things u cannot generalize u can go for an abstract class
take IceCream for instance
it could be of many flavors - vanilla,choclate, coffee, butterscotch.........
so they all will taste() differently depending on their flavor,
but when u say melt() they simply have to ...well melt!!
so in this case u could use an Abstract class Icecream:

abstract class IceCream{
public void melt()

abstract Taste taste();
Ben Souther

Joined: Dec 11, 2004
Posts: 13410


This forum is for Servlet related questions.
Moving to Java In General (Beginner).

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
I agree. Here's the link:
subject: Java
Similar Threads
what is the use of Serialization in java?
Where to use abstract class and Interface?
When and how to customize the ActionServlet
CHEECKY but i need help FAST please!
Re: Serializable