Results 1 to 2 of 2
  1. #1
    speedycerv is offline Member
    Join Date
    Mar 2011
    Posts
    3
    Rep Power
    0

    Default subclass that implements

    I have a problem where i have to add 2 interfaces into class hierarchy of 1 main class.

    it reads: Simulate multiple inheritance by adding at least two
    interfaces into your class hierarchy.

    However As far as I know you can't implement and extend at the same time. You are creating a main class followed by 4 subclasses. I know i could implement one interface on the main class but how would I do this for the subclasses?

    Is creating an abstract class what she means I wonder?

  2. #2
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    You can extend a single class and implement as many classes as you want.
    Java Code:
    class x extends y implements a, b, c, d
    that is fine.

Similar Threads

  1. What does IMPLEMENTS mean?
    By nikkka in forum New To Java
    Replies: 3
    Last Post: 03-07-2011, 12:21 PM
  2. Advanced extends and implements
    By V1C3M4N in forum Advanced Java
    Replies: 15
    Last Post: 11-17-2010, 02:28 PM
  3. Interface and implements
    By Bored2 in forum New To Java
    Replies: 27
    Last Post: 11-10-2010, 02:08 PM
  4. implements
    By danghieu in forum New To Java
    Replies: 1
    Last Post: 04-29-2010, 06:52 PM
  5. ButtonWatcher implements ActionListener
    By darkblue24 in forum New To Java
    Replies: 3
    Last Post: 03-05-2010, 07:18 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
  •