以下代码返回错误说: "constructor call must be the first statment in a constructor."
我不懂.我的代码中的构造函数是第一个语句.我究竟做错了什么?
public class labelsAndIcons extends JFrame
{
public labelFrame()
{
super( "Testing JLabel" );
}
}
Run Code Online (Sandbox Code Playgroud)
构造函数名称必须与类名相同,因此更改要么将类名更改为labelFrame或将构造函数名更改为labelsAndIcons.
示例(请注意,通常第一个字母是java中的大写字母):
public class LabelFrame extends JFrame {
public LabelFrame() {
super( "Testing JLabel" );
}
}
Run Code Online (Sandbox Code Playgroud)