Go Back   TechArena Community > Software > Windows Software
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



What is the difference between extends vs implements in java

Windows Software


Reply
 
Thread Tools Search this Thread
  #1  
Old 07-08-2009
Member
 
Join Date: Nov 2008
Posts: 94
What is the difference between extends vs implements in java
  

Whats the difference between "implements" and "extends"? The class i have implemented automatically inherits all of the superclass's methods and may override any of them (except the ones defined "final") or none of them (except the ones defined "abstract"), whatever you need. I know Extend is used to subclass and Implement is used to inherit. But it isn't configuring perfectly.

Reply With Quote
  #2  
Old 07-08-2009
Member
 
Join Date: Feb 2009
Posts: 72
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.
Reply With Quote
  #3  
Old 07-08-2009
Member
 
Join Date: Oct 2008
Posts: 137
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.
Reply With Quote
  #4  
Old 07-08-2009
Member
 
Join Date: Oct 2008
Posts: 57
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.
Reply With Quote
Reply

  TechArena Community > Software > Windows Software
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "What is the difference between extends vs implements in java"
Thread Thread Starter Forum Replies Last Post
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
What is the difference between an object and an instance in java? Lalit5 Software Development 5 02-03-2009 08:00 PM


All times are GMT +5.5. The time now is 05:23 AM.