A
Amit Jain
Hi All,
I am new to Java and need your views for my query.
What will be the solution for implementint two Interface in a single
class A if these interfaces I1 and I2 are written as mentioned below:
interface I1{
void method ();
long square(long i);
}
interface I2{
String method();
long squareRoot(long i);
}
class A implements I1, I2{
void method(){
System.out.println("--- Hi ----");
}
// implementation of square() and squareRoot() method
}
Above implementation of interface in class A will never complies
because of "void method();" declared in both I1 and I2. And we want
the implementation of I1 and I2 in class A only. How can we acheive
this in such situations.
regards,
Amit J.
I am new to Java and need your views for my query.
What will be the solution for implementint two Interface in a single
class A if these interfaces I1 and I2 are written as mentioned below:
interface I1{
void method ();
long square(long i);
}
interface I2{
String method();
long squareRoot(long i);
}
class A implements I1, I2{
void method(){
System.out.println("--- Hi ----");
}
// implementation of square() and squareRoot() method
}
Above implementation of interface in class A will never complies
because of "void method();" declared in both I1 and I2. And we want
the implementation of I1 and I2 in class A only. How can we acheive
this in such situations.
regards,
Amit J.