Results 1 to 4 of 4

Thread: What is the difference between extends vs implements in java

  1. #1
    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.

  2. #2
    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.

  3. #3
    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.

  4. #4
    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.

Similar Threads

  1. Difference between hashset and hashmap in java
    By ScarFace 01 in forum Software Development
    Replies: 5
    Last Post: 02-02-2010, 08:04 AM
  2. what is the difference between c and java?
    By Linoo in forum Software Development
    Replies: 5
    Last Post: 28-11-2009, 04:11 PM
  3. Difference between Applet and Japplet in java
    By Jalabala in forum Software Development
    Replies: 3
    Last Post: 21-11-2009, 06:48 AM
  4. What is the difference between CORBA and Java RMI?
    By Triple-X in forum Software Development
    Replies: 3
    Last Post: 03-09-2009, 05:59 PM
  5. Replies: 5
    Last Post: 02-03-2009, 08:00 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •