| 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
< 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

0 0

B

1 -1

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
Time
Score
#1lsj0803092212 1m 26s 4
#2ngvandangthanh01 0m 00s -10
#3patrickmeijer00914 1m 35s -25
#4jeonsaw172301 0m 37s -47
#5thamminenigamya11 3m 45s -125
Items per page:
10
1 – 5 of 5
No comments yet. Be the first to comment!

AI Tutor

How can I help?

APFIVE © 2020.
Email: [email protected]|Privacy Policy