Choosing how to earn college credit? CLEP vs AP guide
| preferred AP College board partner for AP classes
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.

No comments yet. Be the first to comment!

AI Tutor

How can I help?

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