public class LeiOverloading
{
public void setVar(int a,int b,float c)
{
System.out.printf("\n");
};
public void setVar(float a,float b)
{
System.out.println("2");
}
}
public static void main(String[] args)
{
LeiOverloading A=new LeioOerloading();
A.setVar(1,1,3);
}
------解决方案--------------------
改好了,刚开始认真点吧,new LeiOverloading()的时候类名写错了,‘{’和‘}’也不匹配
- Java code
public class LeiOverloading{ public void setVar(int a,int b,float c) { System.out.printf("\n"); } public void setVar(float a,float b) { System.out.println("2"); } public static void main(String[] args) { LeiOverloading A=new LeiOverloading(); A.setVar(1,1,3); }}