分析下列程序:public class class4{private string _sData = "";public string sData{set{_sData = value;}}}在Main 函数中,在成功创建该类的对象obj 后,下列哪些语句是合法的?()
A.obj.sData = "It is funny!";
B.Consol
C.WriteLine(obj.sData);
D.obj._sData = 100;
E.obj.set(obj.sData);
A.obj.sData = "It is funny!";
B.Consol
C.WriteLine(obj.sData);
D.obj._sData = 100;
E.obj.set(obj.sData);
第1题
第2题
下列是一个类的定义程序段,请补充完整。 public class My Class { int x,y; MyClass(int i,【 】) { x=i;y=j; } }
第3题
执行下列程序段后输出的结果是【 】。 public class Test{ public static void main(String args[]){ int x,y; for(y=1,x=1;y<=50;y++){ if(x>=10)break; if(x%2==1){ x+=5: continue; } x-=3; } System.out.println(y); } }
第4题
第5题
第6题
下列程序段的输出结果为【 】。 public class Test { void printValue(int m) { do { Systern.out,println("The value is "+m); } while(-m>10); } public static void main(String arg[]){ int i=10; Test t=new Test(); t.print Value(i); } }
第7题
第8题
第9题
第10题
第11题
运行下列程序,会产生什么结果? () public class X exlends Thread implements Runable{ public void run(){ System.out.println("this is run()"); } public static void main(String args[]) Thread t=new Thread(new X()); t.start(); } }
A.第一行会产生编译错误
B.第五行会产生编译错误
C.第六行会产生运行错误
D.程序会运行和启动