In an interface class, all methods are abstract - there is no implementation. In an abstract class some methods can be concrete. In an interface class, no accessibility modifiers are allowed. An abstract class may have accessibility modifiers.
|
|
Inappropriate
|
See Answer
To Email:
Subject:
Note to go along with the question: (Optional, no
more than 1,000 characters)
Yes, but abstract classes are more limited because a class can only extend one class but can implement multiple interfaces.
Create Date
:
Tuesday, May 13, 2008
Click here
to improve the Interview Question, Answer and other fields.
|
|
Inappropriate
|
See Answer
To Email:
Subject:
Note to go along with the question: (Optional, no
more than 1,000 characters)
An abstract class may contain code in method bodies, which is not allowed in an interface. Java does not allow inheritance from multiple classes. On the other hand, you can implement multiple interfaces in your class. Also, an abstract class can contain private and protected members, and non-static member variables.
Create Date
:
Tuesday, May 13, 2008
Click here
to improve the Interview Question, Answer and other fields.
|
|
Inappropriate
|
See Answer
To Email:
Subject:
Note to go along with the question: (Optional, no
more than 1,000 characters)
An abstract class may contain code in method bodies, which is not allowed in an interface. Java does not allow inheritance from multiple classes. On the other hand, you can implement multiple interfaces in your class. Also, an abstract class can contain private and protected members, and non-static member variables.
Create Date
:
Tuesday, May 13, 2008
Click here
to improve the Interview Question, Answer and other fields.
|
|
Inappropriate
|
See Answer
To Email:
Subject:
Note to go along with the question: (Optional, no
more than 1,000 characters)
Abstract class: abstract classes are the class where one or more methods are abstract but not necessarily all method has to be abstract. Abstract methods are the methods, which are declare in its class but not define. The definition of those methods must be in its extending class.
Interface: Interfaces are one type of class where all the methods are abstract. That means all the methods only declared but not defined. All the methods must be define by its implemented class.
Create Date
:
Sunday, May 11, 2008
Click here
to improve the Interview Question, Answer and other fields.
|
|
Inappropriate
|
See Answer
To Email:
Subject:
Note to go along with the question: (Optional, no
more than 1,000 characters)
An abstract class may contain code in method bodies, which is not allowed in an interface. With abstract classes, you have to inherit your class from it and Java does not allow multiple inheritance. On the other hand, you can implement multiple interfaces in your class.
Create Date
:
Saturday, May 10, 2008
Click here
to improve the Interview Question, Answer and other fields.