class Good{
void f1(){
System.out.println("f1()");
}
void f1(int i){
System.out.println("f1(int i)");
}
void f1(double i){
System.out.println("f1(double i)");
}
}
class Good1 extends Good{
void f1(){
System.out.println("导出类的f1()");
super.f1();
f1(1);
f1(1.4);
}
}
public class P713 { /**
* @param args
*/
public static void main(String[] args) {
// TODO 自动生成方法存根
}
Good1 g=new Good1();
g.f1();
}帮小弟看下这个错在哪里 为什么g.f1();会出错
void f1(){
System.out.println("f1()");
}
void f1(int i){
System.out.println("f1(int i)");
}
void f1(double i){
System.out.println("f1(double i)");
}
}
class Good1 extends Good{
void f1(){
System.out.println("导出类的f1()");
super.f1();
f1(1);
f1(1.4);
}
}
public class P713 { /**
* @param args
*/
public static void main(String[] args) {
// TODO 自动生成方法存根
}
Good1 g=new Good1();
g.f1();
}帮小弟看下这个错在哪里 为什么g.f1();会出错
Good1 g=new Good1();
g.f1();
放到main()方法里就好了;
输出:
导出类的f1()
f1()
f1(int i)
f1(double i)
Good1 g=new Good1();
g.f1();
或者
g.f1();
放到一个方法中或放到mian函数中
调用父类方法应该放在第一行吧 偶也是菜鸟 不知道对不对