网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

PublicclassHoltextendsThread{PrivateStringsThreadName;Publicstaticvoidmain(Stringargv[]){Holth=newHolt();h.go();Holt(){};Holt(Strings){sThreadName=s;PublicStringgetThreadName(){returnsThreadName;}}Publicvoidgo(){Hotfirst=newHot("first");first.start();Hotsecond=newHot("second");second.start();}Publicvoidstart(){For(inti=0;i<2;i++){System.out.print(getThreadName()+i);Try{Thread.sleep(100);}catch(Exceptione){System.out.print(e.getMessage());}}}}当编译运行上面代码时,将会出现()

A.编译时错误

B.输出first0,second0,first0,second1

C.输出first0,first1,second10,second1

D.运行时错误


参考答案

更多 “ PublicclassHoltextendsThread{PrivateStringsThreadName;Publicstaticvoidmain(Stringargv[]){Holth=newHolt();h.go();Holt(){};Holt(Strings){sThreadName=s;PublicStringgetThreadName(){returnsThreadName;}}Publicvoidgo(){Hotfirst=newHot(first);first.start();Hotsecond=newHot(second);second.start();}Publicvoidstart(){For(inti=0;i2;i++){System.out.print(getThreadName()+i);Try{Thread.sleep(100);}catch(Exceptione){System.out.print(e.getMessage());}}}}当编译运行上面代码时,将会出现()A.编译时错误B.输出first0,second0,first0,second1C.输出first0,first1,second10,second1D.运行时错误 ” 相关考题
考题 关于下列程序结果正确的是()publicclassMyClassstaticinti;publicstaticvoidmain(Stringargv[])System.out.println(i);。 A.ErrorVariableimaynothavebeeninitializedB.NullC.1D.0

考题 执行下面程序段的输出结果为( )。 public class Q { public static void main(String argv[]) { int anar[]一new int[5]; System.out.println(anar[0]); } }A.0B.1C.2D.5

考题 以下程序的运行结果为:public class Test{public static void main(String argv[ ]){System.out.println("good"+"morning");}} A. goodmorningB. "good"+"morning"C. good morningD. good+morning

考题 以下代码的输出结果?public class Test{int x=3;public static void main(String argv[]){int x= 012;System.out.println(x);}} A.12B.012C.10D.3

考题 以下程序的运行结果为:public class Test{public static void main(String argv[ ]){System.out.println("x="+ 5、;}} A. 5B. x=5C. "x="+5D. "x="5

考题 执行下面的程序段,输出结果为______。publicclassQ{publicstaticvoidmain(Stringargv[]){intanar[]=newint[5];System.out.println(anar[0]);}}

考题 以下哪个是Java应用程序入口的main方法头?A.public static int main(char args[])B.public static void main(String a[])C.public static void MAIN(String args[])D.public static void main(String argv)

考题 17、以下程序的运行结果为? public class Test5{ public static void main(String argv[]){ StringBuffer x = new StringBuffer("你好"); myMethod(x); System.out.print("x=" + x); } public static void myMethod(StringBuffer s){ s.append(",Hi"); } }

考题 执行下面程序段的输出结果为()。 public class Q { public static void main(String argv[]) { int anar[]=new int[5]; System.out.println(anar[0]); } }A.0B.1C.2D.5