-
-11 20
-
public class Text
{
public static void main(String atgs[])
{
new Text(2L);
}
public Text(int x)
{
this();
System.out.println(x*3);
}
public Text(long x)
{
this((int)x);
System.out.print(x);
}
public Text()
{
System.out.print("A");
}
}
运行结果:A 6 2
备注:
构造函数没有返回类型,如果在构造函数中加入VOID,那么他们不在世构造函数而是方法。
◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。
- 评论(0)
发表评论 TrackBack