Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Assuming that x = 2 and y = 3, what does each of the followingstatements display

ID: 3618944 • Letter: A

Question

Assuming that x = 2 and y = 3, what does each of the followingstatements display 1.    System.out.printf( "x= %d " , x ); 2.    System.out.printf( "Value of %d + %d is%d ", x, x, ( x + x ) ); 3.    System.out.printf( "%d = %d ", ( x + y), ( y + x ) ); Assuming that x = 2 and y = 3, what does each of the followingstatements display 1.    System.out.printf( "x= %d " , x ); 2.    System.out.printf( "Value of %d + %d is%d ", x, x, ( x + x ) ); 3.    System.out.printf( "%d = %d ", ( x + y), ( y + x ) );

Explanation / Answer

Assuming that x = 2 and y = 3, what does each of the followingstatements display 1.    System.out.printf( "x= %d " , x);      x=2
2.    System.out.printf( "Value of %d + %d is%d ", x, x, ( x + x ) );    Valueof 2+2 is 4
3.    System.out.printf( "%d = %d ", ( x + y), ( y + x ) );     5 =5