aspose file tools*
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


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "interface and abstract real time Advantages" Watch "interface and abstract real time Advantages" New topic
Author

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
Gowtham gowtham.ganamukala@gmail.com


Thanks, Ganesh Gowtham
http://ganesh.gowtham.googlepages.com
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.

-Kiennjal
[ March 30, 2005: Message edited by: kiennjal shah ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: interface and abstract real time Advantages