Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
Differences between Interfaces and Abstract Classes
What's the difference between an interface and an abstract class?
✍: FYIcenter
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.
Interfaces provide a form of multiple inheritance. A class can extend only one other class. Interfaces are limited to public methods and constants with no implementation.
Abstract classes can have a partial implementation, protected parts, static methods, etc. A Class may implement several interfaces. But in case of abstract class, a class may extend only one abstract class.
Interfaces are slow as it requires extra indirection to to find corresponding method in in the actual class. Abstract classes are fast.
Neither Abstract classe or Interface can be instantiated.
2007-03-03, 5482👍, 0💬
Popular Posts:
How do I use forms? The basic syntax for a form is: <FORM ACTION="[URL]">...&l t;/FORM>Wh...
How to reduce the final size of an executable file? Size of the final execuatable can be reduced usi...
How To Create an Add-to-Bloglines Button on Your Website? - RSS FAQs - Adding Your Feeds to RSS News...
Example of using Regular Expressions for syntax checking in JavaScript ... var re = new RegExp("^(&a...
How To Use mysqlbinlog to View Binary Logs? - MySQL FAQs - Server Daemon mysqld Administration If yo...