应该是指此接口的一个实例.interface Funny {
public void playSound(String str);
}public class MyFunny implements Funny {
...
public void playSound(String str) {
System.out.println("str="+str);
}
}public class T {
public void test( Funny x) {
x.playSound("hello");
}
public static void main(String[] args) {
Funny x = new MyFunny();
T t = new T();
t.test(x);
}
}
public void playSound(String str);
}public class MyFunny implements Funny {
...
public void playSound(String str) {
System.out.println("str="+str);
}
}public class T {
public void test( Funny x) {
x.playSound("hello");
}
public static void main(String[] args) {
Funny x = new MyFunny();
T t = new T();
t.test(x);
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货