Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4364796

Multiple inheritance of same signature methods declared in interfaces.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.3.0
    • tools
    • x86
    • windows_95



      Name: tb29552 Date: 08/22/2000


      java version "1.3.0"
      java TM 2 Runtime Environment, Standard Edition (build 1.3.0-c)
      Java HotSpot(TM) Client VM (build 1.3.0-c, mixed mode)



      Sir,
          Suppose that I have two interface namely, Test1 and Test2, and I have a
      method test() which is there in two interfaces. The test() method in two
      interfaces is having the same signature. If I want to implement the two
      interfaces in a class called Test, then I can only give implementation to any
      one of the two methods, because compiler does not allow me implement more than
      one method with same signatures. So, how can I work around this problem. I
      suppose this is a bug. Please consider this.

          Suppose that one big project is there. In this scenario this problem may
      occur.


      //
      interface Test1 {
          int test(int i);
      }
      interface Test2 {
          int test(int i);
      }

      class MultipleInterface implements Test1, Test2 {
          public int test(int i) {
              return (i + 4);
          }

          public static void main(String[] args) {
              MultipleInterface my = new MultipleInterface ();
              int r = my.test(67);
              System.out.print("test() method returned: ");
              System.out.println(r);
          }
      }

      (Review ID: 108733)
      ======================================================================

            Unassigned Unassigned
            tbell Tim Bell
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: