• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Interface And abstract

 
abalfazl hossein
Ranch Hand
Posts: 635
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See Interface vs. Abstract Class (linked to from our Beginners FAQ).
 
fred rosenberger
lowercase baba
Bartender
Posts: 12196
35
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Campbell Ritchie
Sheriff
Pie
Posts: 50175
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stan, in the original white paper about the Java language, look at �2.2.5 about multiple inheritance.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic