4 What is printed by the following segment of Java code int

 4.      What is printed by the following segment of Java code?         int[] A = {3, 4, 1, 2};         int T = 2;         A[T - 1]--;         A[T] = A[T + 1] - 1;         T = A[T];         A[T - 1] += 1;         A[T + 2] = 2 * A[T + 2] - 1;         System.out.println(A[0] + \" \" + A[1] + \" \" + A[2] + \" \" +     A[3] + \" \" + T);  

Solution

output:

4 3 1 3 1

explanation:

 4. What is printed by the following segment of Java code? int[] A = {3, 4, 1, 2}; int T = 2; A[T - 1]--; A[T] = A[T + 1] - 1; T = A[T]; A[T - 1] += 1; A[T + 2]

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site