Results 1 to 3 of 3
  1. #1
    ajaygargnsit is offline Member
    Join Date
    Dec 2007
    Posts
    9
    Rep Power
    0

    Default Doubt in simultaneous 'implementation' and 'extension'

    ////////// Start of code snippet ///////////////

    interface i1
    {
    public void f1();
    }

    interface i2 extends i1
    {
    public void f2();
    }

    class c1 implements i1
    {
    public void f1(){}
    }

    // Error flashed for this class
    class c2 implements i2 extends c1
    {
    public void f2(){}
    }

    ///////////////////// End of code ///////////////////////////////

    Now, this is what I assume ::
    Since c2 is a derived class of c1, implementation of f1() must be visible in c2.

    But the compiler says that implementation of f1() needs to be done.



    What's wrong ??

  2. #2
    daprodigy is offline Member
    Join Date
    Dec 2007
    Location
    Roggwil, Switzerland
    Posts
    8
    Rep Power
    0

    Default

    hello

    the syntax is wrong ...

    class c2 extends c1 implements i2

    ... then, i can compile the code.

    hope this helps

  3. #3
    ajaygargnsit is offline Member
    Join Date
    Dec 2007
    Posts
    9
    Rep Power
    0

    Default Thank you !!

    Yeah, i did the change; it works.

    Thanks again.

Similar Threads

  1. Replies: 0
    Last Post: 04-05-2008, 10:13 AM
  2. Regex for file extension
    By gapper in forum New To Java
    Replies: 1
    Last Post: 01-31-2008, 03:59 PM
  3. doubt in jms
    By veena in forum Enterprise JavaBeans (EJB)
    Replies: 2
    Last Post: 01-05-2008, 01:42 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
  •