Difference b/w Abstract Class and Interface

Hi, can anyone tell the difference between Abstract class and an Interface?Thanks in advance!
[114 byte] By [NKGa] at [2007-11-27 0:27:26]
# 1
in simple terms...an abstract class can have code that does stuff, and interface can only declair methods and not implement them and cannot have local variables.
robtafta at 2007-7-11 22:27:11 > top of Java-index,Java Essentials,Java Programming...
# 2
Abstract class has abstract methods as well as concrete methods but in Interface all methods are abstract and varables are static, final.
Anshula at 2007-7-11 22:27:11 > top of Java-index,Java Essentials,Java Programming...
# 3

> Abstract class has abstract methods as well as

> concrete methods but in Interface all methods are

> abstract and varables are static, final.

But that still doesn't make the following an interface:public abstract class NotAnInterface {

public static final String foo= "foo";

public abstract void bar();

public abstract void baz();

}

All is abstract and/or static final; but the above is still just a class.

kind regards,

Jos

JosAHa at 2007-7-11 22:27:11 > top of Java-index,Java Essentials,Java Programming...
# 4
can u please describe the difference in real scenerio with any example. I mean where we use Abstract class and where we use Interface?
NKGa at 2007-7-11 22:27:11 > top of Java-index,Java Essentials,Java Programming...
# 5

> can u please describe the difference in real scenerio

> with any example. I mean where we use Abstract class

> and where we use Interface?

For a nice real world example read the API docs for part of the Collection

framework, e.g. List, AbstractList, ArrayList etc.

kind regards,

Jos

JosAHa at 2007-7-11 22:27:11 > top of Java-index,Java Essentials,Java Programming...
# 6
The majoor diiffernce is that Interface canot ber inherited while absract calss can be inherited one abract class can iheret other abstract class while Interface doesnot
NabiBukhasha at 2007-7-11 22:27:11 > top of Java-index,Java Essentials,Java Programming...
# 7
> The majoor diiffernce is that Interface canot ber> inherited while absract calss can be inherited > one abract class can iheret other abstract class> while Interface doesnot?
georgemca at 2007-7-11 22:27:11 > top of Java-index,Java Essentials,Java Programming...