wood burning stoves 2.0*
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 Android Security Essentials Live Lessons this week in the Android 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: 38039
    
  22
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
 
Similar Threads
why we use abstract class?
abstract class and interface used which real life senario in java/j2ee application
INTERFACE & ABSTRACT in JAVA!!!
IS-A / HAS-A relationships. Chapter 2 Question 14 page 180
Use of interface