package bag;
public class x1{
int x,y;
public x1(int i,int j){
this.x=i;
this.y=j;
System.out.println("x="+x+""y="+y);
}
public void show(){
System.out.println("this class is a x2");
}
}
public class x1{
int x,y;
public x1(int i,int j){
this.x=i;
this.y=j;
System.out.println("x="+x+""y="+y);
}
public void show(){
System.out.println("this class is a x2");
}
}
this.x=i;
this.y=j;
System.out.println("x="+x+"y="+y);
}这个方法要有个返回类型,改为:public void x1(int i,int j){
this.x=i;
this.y=j;
System.out.println("x="+x+"y="+y);
}
1)System.out.println("x="+x+""y="+y);//多了个双引号,笔误?2)类名不用大写开关是很不规范滴!!3)public void show(){
System.out.println("this class is a x2");
}
你定义的明明是x1,又告诉人说是x2,这不典型的挂羊头卖狗肉么??4)如果你这个工程只有这个类,那么会提示你说没有main入口的
——难道你说的是这个错误?