?

AP® Computer Science A

Free Version

Upgrade subject to access all content

Moderate

String Manipulation with Substring

APCSA-LBLDIL

Given a String str of even length, which line of code captures the first half of the String?

A

String half = str.substring(2);

B

String half = str.substring(str.length()/2);

C

String half = str.substring(0, str.length()/2);

D

String half = str.indexOf(2);

E

String half = str.getHalf();