This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Interface And abstract 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 "Interface And abstract" Watch "Interface And abstract" New topic
Author

Interface And abstract

abalfazl hossein
Ranch Hand

Joined: Sep 06, 2007
Posts: 635
Hello!

When we have abstract,Why do we ue interface?

By abstract we have variable,But in interface we have not(other than variable that has constant value)

What is difference of the abstract usage and interface usage?
When do we need to interface?
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

See Interface vs. Abstract Class (linked to from our Beginners FAQ).


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11161
    
  16

hint - how many classes can you extend from?

how many interfaces can you implement?

This is not the only, definitive answer, but it's a pretty good one.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
I've wondered about that FAQ. Is this statement: Actually the first point is the reason for the existence of interfaces in Java: to provide a form of multiple inheritance. supported in Sun literature?


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38025
    
  22
Stan, in the original white paper about the Java language, look at �2.2.5 about multiple inheritance.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Interface And abstract
 
Similar Threads
Real Time Scenerio for abstract class and interface
difference between interface and abstract
WHY Abstract when we have Inheritance n interface
abstract class and interface
what is the need to go for java refelection