Limited access

Upgrade to access all content for this subject

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();

Select an assignment template