File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes which senario we use abstract and interface in java 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 "which senario we use abstract and interface in java " Watch "which senario we use abstract and interface in java " New topic
Author

which senario we use abstract and interface in java

raja pulleboina
Greenhorn

Joined: Dec 10, 2009
Posts: 12

please exaplin the real time senario where we can use abstract and interface in java ...???

Ksh Aggarwal
Greenhorn

Joined: Sep 16, 2009
Posts: 28
raja pulleboina wrote:
please exaplin the real time senario where we can use abstract and interface in java ...???



interface is basically a pure abstract class. interface only specifies the methods that should be present in any class which is implementing that interface.
abstract classes on other hand can have non-abstract methods i.e. methods which are already implemented. these methods can then be directly used in class extending the abstract class.

now the real life difference that comes is basically how you want to implement a certain design problem. interfaces generally define the behavior that a class needs to follow. abstract classes on other hand shows what type of class it is. this is also the difference in extending a class and implementing an interface.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39393
    
  28
Have you seen our FAQ?
Muhammad Khojaye
Ranch Hand

Joined: Apr 12, 2009
Posts: 449

When use Abstract or Interface


http://muhammadkhojaye.blogspot.com/
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: which senario we use abstract and interface in java