单选题:What will happen when you attempt to compile and run this code?
What will happen when you attempt to compile and run this code? @[D](2)
```Java
class Base {
void f(int i) {System.out.println("int"); }
void f(double d) {System.out.println("double");}
}
public class Fin implements Base {
void f(String s) { System.out.println("String"); }
public static void main(String argv[]){
Fin a = new Fin();
a.f(10);
}
}
```
A. It does not compile because there is only the f() for String
B. It does not compile because f(String) does not match any of the two f() in Base class
C. It complies and prints String
D. It compiles and prints int
A.It does not compile because there is only the f() for String
B.It does not compile because f(String) does not match any of the two f() in Base class
C.It complies and prints String
D.It compiles and prints int
答案:D
```Java
class Base {
void f(int i) {System.out.println("int"); }
void f(double d) {System.out.println("double");}
}
public class Fin implements Base {
void f(String s) { System.out.println("String"); }
public static void main(String argv[]){
Fin a = new Fin();
a.f(10);
}
}
```
A. It does not compile because there is only the f() for String
B. It does not compile because f(String) does not match any of the two f() in Base class
C. It complies and prints String
D. It compiles and prints int
A.It does not compile because there is only the f() for String
B.It does not compile because f(String) does not match any of the two f() in Base class
C.It complies and prints String
D.It compiles and prints int
答案:D