It's not a secret anymore!
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
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply 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: 32654
    
    4
Have you seen our FAQ?
Muhammad Khojaye
Ranch Hand

Joined: Apr 12, 2009
Posts: 341
When use Abstract or Interface


http://muhammadkhojaye.blogspot.com/
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: which senario we use abstract and interface in java
 
Similar Threads
Use of interface
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
why we use abstract class?