Results 1 to 2 of 2
  1. #1
    makpandian's Avatar
    makpandian is offline Senior Member
    Join Date
    Dec 2008
    Location
    Chennai
    Posts
    448
    Rep Power
    6

    Default how to implement interface

    i create interface

    interface arith
    {
    int sum(int a,int b);
    int sub(int x,int y);
    }


    when i implenent this interface i only define int sum(int a,int b);

    but i got a error that the function sub did not define.but i only access sum function only not sub.....

    should we define all declare function in interface?....

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    When you implement an interface you must implement all methods in that interface in the implementing class.

    Can you show how you implement that interface.

Similar Threads

  1. Can generic types implement an interface?
    By jdgallag in forum New To Java
    Replies: 3
    Last Post: 10-30-2008, 04:07 AM
  2. Replies: 1
    Last Post: 10-20-2008, 12:58 PM
  3. How to implement the Icon interface in Java
    By Java Tip in forum java.awt
    Replies: 0
    Last Post: 06-23-2008, 11:17 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
  •