正在加载图片...
JAVA THREADS-EXAMPLE PROGRAM public class Driver { public static void main(String[]args){ if (args.length 0){ if (Integer.parseInt(args [O])<0) System.err.println(args [O]+must be >0."); else //create the object to be shared MutableInteger sum new MutableInteger(); int upper Integer.parseInt (args [O]); Thread thrd =new Thread(new Summation(upper,sum)); thrd.start(); try thrd.join(); System.out.println ("The sum of "+upper+"is "+sum.getValue()) } catch (InterruptedException ie){} else System.err.println("Usage:Summation <integer value>"); }JAVA THREADS - EXAMPLE PROGRAM
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有