|
| ||||||||||
| Tags: implements extends, java extends, superclass method |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| What is the difference between extends vs implements in java
|
|
#2
| ||||
| ||||
| Re: What is the difference between extends vs implements in java
I recently did a DHTML lesson on Inheritance for the Java class that I teach. Please look at the Java Tutorial on java.sun.com for an explanation of classes and interfaces . You'll need IE4 or later as we've standardized on IE at the school and I didn't have time to make it cross-browser. Java does allow you to implement multiple interfaces. |
|
#3
| |||
| |||
| Re: What is the difference between extends vs implements in java
Java does not allow you to extend multiple classes. This avoids some problems related to multiple inheritance, When you want to subclass from an existing class( inheritance ) you use the extends keyword. When you want to implent an interface, You can only extend one class in java, but you can implement many interfaces. |
|
#4
| |||
| |||
| Re: What is the difference between extends vs implements in java
Simply put, extents is used when creating a subclass and implements is used when implementing an interface. When you "implement" a class, the parent class had nothing more than the method definitionSince java only allows for single inheritance of superclasses implementing interfaces is a way around this restriction. Interfaces are about subtyping and polymorphism, whereas, inheriting methods is about code reuse. |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "What is the difference between extends vs implements in java" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Difference between Java and Symbian phone | Lambodar | Portable Devices | 6 | 17-09-2010 12:06 AM |
| Difference between hashset and hashmap in java | ScarFace 01 | Software Development | 5 | 02-02-2010 08:04 AM |
| what is the difference between c and java? | Linoo | Software Development | 5 | 28-11-2009 04:11 PM |
| Difference between Applet and Japplet in java | Jalabala | Software Development | 3 | 21-11-2009 06:48 AM |
| What is the difference between CORBA and Java RMI? | Triple-X | Software Development | 3 | 03-09-2009 05:59 PM |