public class MyLable{
String x,y; public MyLable(String x1,String y1)//构造函数不能有返回值,去掉void,如果有话,编译器把它看作普通函数
{
this.x=x1;
this.y=y1;
}
void print()
{
System.out.println(x+y);
}
public static void main(String[] args)
{
MyLable testLable = new MyLable("hello ","world");
testLable.print();
}
}
希望把基础的再看看,这样的问题不应该错的
String x,y; public MyLable(String x1,String y1)//构造函数不能有返回值,去掉void,如果有话,编译器把它看作普通函数
{
this.x=x1;
this.y=y1;
}
void print()
{
System.out.println(x+y);
}
public static void main(String[] args)
{
MyLable testLable = new MyLable("hello ","world");
testLable.print();
}
}
希望把基础的再看看,这样的问题不应该错的
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货