What is the exact difference between abstract classes and interface

What is the exact difference between abstract classes and interface in real scenario?Plz could you give a practical example?Thanks
[151 byte] By [Knowledge.is.Powera] at [2007-10-2 9:37:39]
# 1

I believe if you search 'abstract classes versus interfaces' here you will get hundreds of hits. Google will return thousands more. This horse has been beaten to death. There is undoubtedly an answer in one of the numerous threads already posted.

If anyone else feels charitable, then by all means chime in. I've retyped this one personally well over a dozen times. And beer, she is a callin'!

- Saish

Saisha at 2007-7-16 23:43:47 > top of Java-index,Other Topics,Patterns & OO Design...
# 2

> What is the exact difference between abstract classes

> and interface in real scenario?

>

> Plz could you give a practical example?

>

> Thanks

One allows you to define behavior, the other implementation that can be extended. If you want a real scenario go look at List and AbstractList.

kablaira at 2007-7-16 23:43:47 > top of Java-index,Other Topics,Patterns & OO Design...
# 3
I want to know the Exact Realation and difference between Abstract Class and Interfaces
us.karthika at 2007-7-16 23:43:47 > top of Java-index,Other Topics,Patterns & OO Design...
# 4
> I want to know the Exact Realation and difference> between Abstract Class and InterfacesThen read the replies that are already there from two months ago.
kablaira at 2007-7-16 23:43:47 > top of Java-index,Other Topics,Patterns & OO Design...
# 5
*THUNK*
jverda at 2007-7-16 23:43:47 > top of Java-index,Other Topics,Patterns & OO Design...
# 6
That's a bit less than satisfying without a kill file, don't you agree?Oh to have thunked Goldie - I don't know who I hate more, AU_UK or Sun for not giving us NNTP access to these fora.
tsitha at 2007-7-16 23:43:47 > top of Java-index,Other Topics,Patterns & OO Design...
# 7
LOLTrue.However, that *THUNK* was just the sound of my head hitting the desk.
jverda at 2007-7-16 23:43:47 > top of Java-index,Other Topics,Patterns & OO Design...
# 8
oh. Right. Sorry about that.At least your head doesn't make a *plonk* sound.That'd be weird.
tsitha at 2007-7-16 23:43:47 > top of Java-index,Other Topics,Patterns & OO Design...
# 9

> At least your head doesn't make a *plonk* sound.

Mine just makes a splutchy bursting watermelon type sound.

To the original poster - to make things simple, if there is any doubt about which you should use, use an interface. If the situation calls for an abstract class, you will know that an interface is the wrong choice, because it will be impossible to do what you want to do with an interface.

Drake

Drake_Duna at 2007-7-16 23:43:47 > top of Java-index,Other Topics,Patterns & OO Design...