Difference between an interface and an abstract class

Hey:I'm curious, what's the difference between an interface and an abstract class? Thanks.
[113 byte] By [HFactor] at [2007-9-26 1:33:00]
# 1

An abstract class can have method implementations and constructors. An interface cannot have method implementations or constructors.

An abstract class can have instance fields. An interface cannot have instance fields.

An abstract class can have variable class fields. An interface can have only final class fields.

An abstract class can have protected, package, and private members. An interface can have only public members.

A class can extend only one class, but a class can implement more than one interface.

schapel at 2007-6-29 1:34:53 > top of Java-index,Archived Forums,New To Java Technology Archive...
# 2
Okay, then:why declare a class abstract if you are going to implement it?
HFactor at 2007-6-29 1:34:53 > top of Java-index,Archived Forums,New To Java Technology Archive...
# 3

Huh? You implement methods, not classes.

You have an abstract class if you want to implement some of the methods in it, but you do not want users to make instances of the class or do not want to implement all of the methods. Take a look at some of the abstract classes in java.util. Nearly all of the methods are implemented already so that it's far easier to create new data structures than if only interfaces were provided.

schapel at 2007-6-29 1:34:53 > top of Java-index,Archived Forums,New To Java Technology Archive...
# 4

"You have an abstract class if you want to implement some of the methods in it, but you do not want users to make instances of the class or do not want to implement all of the methods. Take a look at some of the abstract classes in java.util. Nearly all of the methods are implemented already so that it's far easier to create new data structures than if only interfaces were provided. "

That's what I was looking for. Thanks.

HFactor at 2007-6-29 1:34:53 > top of Java-index,Archived Forums,New To Java Technology Archive...