asked 109k views
4 votes
Given that String[] str has been initialized, to get a copy of str[0] with all characters converted to upper case, use the following statement:

a. str[0].toUpperCase();
b. str.toUpperCase();
c. str[0].UpperCase();
d. str.UpperCase();

asked
User Norepro
by
8.4k points

1 Answer

6 votes

Answer: str[0].toUpperCase();

Step-by-step explanation:

str[0] is pointing to the first character of the entire string and the code str[0].toUpperCase() will convert the characters to upper case if they are in lowercase and will remain unchanged if they are already in upper case.

answered
User Vincent Durmont
by
7.8k points