Are you taking CLEP classes? Try clep.ai
| preferred AP College board partner for AP classes
AP Computer Science A/Unit 1: Primitive Types
Start Practice TestPractice Test
About Exam
easy Solved by 4 students

String compareTo Method Output

Mark
< Prev
Next >

What is printed to the console when the following code segment is executed?

String s1 = "avocado";
String s2 = "banana";
System.out.println(s1.compareTo(s2) + " " + s2.compareTo(s1));
A

-1 -1

B

0 0

C

1 -1

D

-1 1

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

Question Leaderboard

Rank
User
Correct Count
Attempt Count
Total Time
Score
#1lsj0803092212 1m 26s 4
#2ngvandangthanh01 0m 00s -10
#3Potter1601 0m 07s -17
#4patrickmeijer00914 1m 35s -25
#5jeonsaw172301 0m 37s -47
#6thamminenigamya11 3m 45s -125
Items per page:
10
1 – 6 of 6

AI Tutor

How can I help?

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