Organizational Research By

Surprising Reserch Topic

implementing two interfaces in a class with same method which interface method


implementing two interfaces in a class with same method which interface method  using -'java,interface,override'

Two interfaces with same method names and signatures. But implemented by a single class then how the compiler will identify the which method is for which interface?

Ex:

interface A{
  int f();
}

interface B{
  int f();
}

class Test implements A, B{   
  public static void main(String... args) throws Exception{   

  }

  @Override
  public int f() {  // from which interface A or B
    return 0;
  }
}   

    
asked Sep 10, 2015 by VanCrump
0 votes
4 views



Related Hot Questions



Government Jobs Opening


...