File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes interface and abstract real time Advantages Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "interface and abstract real time Advantages" Watch "interface and abstract real time Advantages" New topic

interface and abstract real time Advantages

Ganesh Gowtham
Ranch Hand

Joined: Mar 30, 2005
Posts: 225

hi guys ...
let me know real time issues where it absract and interface will be used ...
Since java denies multiple inheritance , so we will be using interface ...
wher in the case trully speaking mul;tiplr inheritance we have neither implemented mtds but interfaces is noit like that ..
class which implenmnts sud provide the defn then what is use
Thx in advnace

Thanks, Ganesh Gowtham
Jeff Bosch
Ranch Hand

Joined: Jul 30, 2003
Posts: 805
One word: Polymorphism. That's the use...

Give a man a fish, he'll eat for one day. Teach a man to fish, he'll drink all your beer.
Cheers, Jeff (SCJP 1.4, SCJD in progress, if you can call that progress...)
kiennjal shah
Ranch Hand

Joined: Jun 17, 2004
Posts: 31
Yes, thats one of the main benefits of OOP, polymorphism.

For instance, you can have an interface as:

now I may have many classes such as Ferrari, Porche etc.. which can benefit by using this public abstract method of the interface car w/o having to rewrite the method again and again. Also we can set some variables in the interface (which btw, are public static and final by default) and benefit by using them in various classes.

Hope this helps.

[ March 30, 2005: Message edited by: kiennjal shah ]
I agree. Here's the link:
subject: interface and abstract real time Advantages
It's not a secret anymore!