正在加载图片...
三、程序解析题(10道) 1.编译如下代码可能出现的结果是 public class Holt extends Thread private String s ThreadName public static void main(String argvM Holt h= new Holt h goo Holton olt(String s) sThreadName = s: public String getThreadName O return s ThreadName public void goo( Holt first new Holt( first); first start Holt second new Holt("second") second start public void start(( for(int i=0; i< 2; i++) System.out. printIn(get ThreadName 0 +i) Icatch(Interrupted EXceptione) System. out. printin(e. getMessageOD. friend 三、 程序解析题(10 道) 1.编译如下代码可能出现的结果是 public class Holt extends Thread{ private String sThreadName; public static void main(String argv[]){ Holt h = new Holt(); h.go(); } Holt(){} Holt(String s){ sThreadName = s; } public String getThreadName(){ return sThreadName; } public void go(){ Holt first = new Holt("first"); first.start(); Holt second = new Holt("second"); second.start(); } public void start(){ for(int i = 0; i < 2; i ++){ System.out.println(getThreadName() +i); try{ Thread.sleep(100); }catch(InterruptedExceptione){ System.out.println(e.getMessage());
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有