为什么这个程序不加构造就会报错呢????
java不是可以自动生成构造函数吗??但我不加构造函数这个程序却报错,有点困惑,
import java.awt.*;
public class MyFrame extends Frame{
public static void main(String args[]){
MyFrame fr=new MyFrame("Please see there!this is a frame");
fr.setSize(400,200);
fr.setBackground(Color.yellow);
fr.setVisible(true);
}
public MyFrame(String str){ //此处构造函数为什么必须有呢???是起什么作用的呢??
super(str);
}
}