【发布时间】:2020-08-07 22:51:00
【问题描述】:
我想从公共 java 类中的默认构造函数调用参数化构造函数。
我能做到吗?
public Rectangle()
{
Rectangle(10.5f,2.5f) //this not working
}
public Rectangle(float length, float breadth)
{
code...
}
【问题讨论】:
-
this(10.5f, 2.5f). -
还有,别忘了结束;
标签: java constructor