Limited access

Upgrade to access all content for this subject

Given a String str of length at least two, which line of code would take the last two characters in the String and move them to the beginning of the String?

A

String reverse = str.substring(str.length() - 1) + str.substring(0, str.length()-1);

B

String reverse = str.substring(str.length()) + str.substring(0, str.length());

C

String reverse = str.substring(str.length() - 2, str.length() - 1) + str.substring(0, str.length()-2);

D

String reverse = str.substring(0, str.length()-2) + str.substring(str.length() - 2)

E

String reverse = str.substring(str.length() - 2) + str.substring(0, str.length()-2);

Select an assignment template