【说明】 下面的程序的功能是利用实现Runnable接口的方法来创建线程,并利用它来执行响应的一些操作。最后使得m的执行结果:100,如图3。
注意:请勿改动main()主方法和其他已有的语句内容,仅在下划线处填入适当的语句。 class ClassName (1) Runnable { int n; (2) { try{Thread. sleep (2000);n=100; }catch( (3) e) {} } public static void main(String[ ]args) {try{ ClassName a = new ClassName( ); (4) threadl. (5) (); threadl, join( ); int m=a.n; System. out. println("m=" + m);}catch( (3) e){} } }