what is wrong with the following program?ublic class SomethingIsWrong {public static void main(String[] args){Rectangle myRect;myRect.width = 40;myRect.hight =50;System.out.println('myRect's area is"+myRect.area());}

来源:学生作业帮助网 编辑:作业帮 时间:2024/07/06 18:24:05
what is wrong with the following program?ublic class SomethingIsWrong {public static void main(String[] args){Rectangle myRect;myRect.width = 40;myRect.hight =50;System.out.println('myRect's area is
xQMO@+/H =QUjۤ_.6  &FDT@g -* f{3f9=m TypɲfJ M0WRdh EZGe!T@dAiG @)dXS)BDI1H&"¼jU&"!]k{!s&M\a@f]'끲4ϿwuGٍk]"ʛfB7"WW}njUu;v n֟~qF, mg&* {Τ#NV,G:T~-{

what is wrong with the following program?ublic class SomethingIsWrong {public static void main(String[] args){Rectangle myRect;myRect.width = 40;myRect.hight =50;System.out.println('myRect's area is"+myRect.area());}
what is wrong with the following program?
ublic class SomethingIsWrong {
public static void main(String[] args){
Rectangle myRect;
myRect.width = 40;
myRect.hight =50;
System.out.println('myRect's area is"+myRect.area());
}

what is wrong with the following program?ublic class SomethingIsWrong {public static void main(String[] args){Rectangle myRect;myRect.width = 40;myRect.hight =50;System.out.println('myRect's area is"+myRect.area());}
Rectangle myRect;
这里没初始化,改成
Rectangle myRect = new Rectangle(这里输入构造方法的参数,如果没参数就不用输);
记住,要用到一个实例,必须先实例化一个实例.