Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

doubt from Khalid Mughal pgno:257

 
sukhavasi vasavi
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
abstract public class SyncTest implements Int1,Int2{

public void f(){
System.out.println("i1");

}
public void g(){
System.out.println("I!g");
}
}


interface Int1{
int a=1;
int b=2;
void f();
void g();
}
interface Int2{
int b=3;
int c=4;
void g();
void h();
}
My doubt is How it compile correctly because there is an ambiguity in the function g().Please explain
 
Akhilesh Trivedi
Ranch Hand
Posts: 1608
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It doesnt matter because interface is going to have only declaration, and actual implementation will be supplied by the class implementing the interface.
 
perakam gopi
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

No your thinking in wrong way,here we are not doing any method overloading or overriding,just we are declaring an interface.so there is no problem it works correctly.
Regards
GopiPerakam
 
sukhavasi vasavi
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes.Now I got it
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic