Are you taking CLEP classes? Try clep.ai
| preferred AP College board partner for AP classes
AP Computer Science A/Unit 4: Iteration
Start Practice TestPractice Test
About Exam
hard

Array and String Object Comparison

Mark
< Prev
Next >

What is printed as a result of executing the following code segment?

String[] arr1 = {“apple”, “banana”};
String[] arr2 = {“apple”, “banana”};
String[] arr3 = arr1;

System.out.println(arr1 == arr2);
System.out.println(arr1 == arr3);
System.out.println(Arrays.equals(arr1, arr2));
System.out.println(arr1[0] == arr2[0]);

A

false
true
true
false

B

true
true
true
true

C

false
false
false
true

D

false
true
true
true

Hint
Did You Know?
Explain Why
Explain All Answers
Check Answer
Show Correct Answer
Report Question

Question Leaderboard

Not enough data yet to show leaderboard.

AI Tutor

How can I help?

APFIVE © 2020.
Email: apfive@apfive.org|Privacy Policy|