• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Real Time Scenerio for abstract class and interface

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
when do we use abstract class and interface?do we have any real time example?
 
Ranch Hand
Posts: 1970
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm guessing you don't really mean real time.
 
Ranch Hand
Posts: 694
Mac OS X Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Java Ranch,

I take it that you mean "real-world" instead of "real-time".

A real-world example is a "fruit". We can consider using either an interface or an abstract class. Since all fruits have a common property, weight, an abstract class should be used rather than an interface since interfaces can't contain variables. (Though, you might find a reason to use both an abstract class and interfaces).

Concrete classes of fruit could be "apple", "bannanna", and a "pear".



Kaydell
[ June 11, 2007: Message edited by: Kaydell Leavitt ]
 
Giri moh'kar
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Kaydell Leavitt..
 
reply
    Bookmark Topic Watch Topic
  • New Topic