8
answers
0
watching
619
views
8 Jan 2018

3. What is printed to the screen when the following program is run? (6 points) public class Alias Test { public static void main(String[] args) { int) foo = {1,2,3,4,5}; int[] bar = {20, 21, 22, 23); int) chocolate = bar; bar[0] = 30; chocolate [1] = chocolate [0] + foo(0); System.out.println("Phase 1"); System.out.println (bar[0]); System.out.println (chocolate[0]); System.out.println (foo [0]); System.out.println (bar[1]); bar - foo; foo - chocolate; foo [31 - foo [2] + foo[1]; System.out.println("Phase 2"); System.out.println (foo [1]); System.out.println (foo [2]); System.out.println (foo [3]); foo = new int [10); foo [0] = 3; System.out.println("Phase 3"); System.out.println(chocolate[0]); System.out.println (chocolate[1]); System.out.println(chocolate[21); System.out.println(chocolate[3]); //WHAT IS PRINTED TO THE SCREEN IN THIS RUN? What is printed to the screen when the above program is run?

For unlimited access to Homework Help, a Homework+ subscription is required.

Unlock all answers

Get 1 free homework help answer.
Already have an account? Log in
Already have an account? Log in
Already have an account? Log in
Already have an account? Log in
Already have an account? Log in
Already have an account? Log in
Already have an account? Log in
Beverley Smith
Beverley SmithLv2
9 Jan 2018
Already have an account? Log in

Weekly leaderboard

Start filling in the gaps now
Log in