题目内容

以下程序启动了十个线程,其中五个进程负责对变量x加1,另外五个进程负责对变量x减1,且进程之间互不干扰。public class Demo{private int x=0;public static void main(String[] args) {Demo demo=new Demo ();Add add = ____ (1)___;Sub sub = ____ (2)____;for(int i=1;____ (3)_____;i++){new Thread(add,"加线程"+i).start();new Thread(sub,"减线程"+i).start();}}class Add implements Runnable{public void run() {for(int i=0;i<10;i++){ operateX(0); }}}class Sub implements Runnable{public void run() {for(int i=0;i<10;i++){ operateX(1);}}}public ___ (4)____ void operateX (int n) {if(____ (5)___) x++; else x--;}}

查看答案
更多问题

以下代码运用泛型实现了数组的倒排。请给出缺失的代码,使程序能正确执行。class ArrayUtils {public void reverse(T[] arr) { //倒排数组for (int i = 0; i < ___(1)___; i++) {____(2)___ = arr[i];arr[i] = arr[arr.length - 1 - i];arr[arr.length - 1 - i] = tem;}}}public class TestRawTypeClass {public static void main(String[] args) {ArrayUtils au1 = ___(3)____;Integer[] arr1 = new Integer[] { 1, 2, 3, 4, 5 };System.out.println("原数组:"+Arrays.toString(arr1));au1.reverse(arr1); //倒排数组System.out.println("反转后:"+Arrays.toString(arr1));

Listen to thetransmission or short exchangeand choose the correct answer.

A. Take the first right
B. Take the first left
C. Via taxiway C
D. Via taxiway D

Listen to thetransmission or short exchangeand choose the correct answer.

A. Taxiway G and L to Gate 114
B. Take A1to Gate 114
C. Taxiway G and L to Gate 14
D. Take A1 to Gate 14

Listen to thetransmission or short exchangeand choose the correct answer.

A. Backtrack and vacate runway 04
B. Turn left onto taxiway A4 proceed to C3
C. Via A3 and C4.
D. Via A3 and C3.

答案查题题库