29.9k views
1 vote
Given that String[] str has been initialized, to get a copy of str[0] with all the characters converted to uppercase, you would use the ________ statement. Group of answer choices str.toUpperCase(); str.uppercase(); str[0].upperCase(); str[0].toUpperCase();

User Wantok
by
4.3k points

2 Answers

5 votes

Answer:

str[0].toUpperCase(); is the correct answer to the following question.

Step-by-step explanation:

In the following code is the code which is in the Java Programming Language.

Here, the variable "str" is the string data type array variable which contains characters or words and the index 0 "[0]" indicating the first element of the string array then, "toUpperCase()" is the built-in function that is used to convert lowercase string characters or words to the upper case.

So, the following code converts the first element of the string into the upper case.

User Martney Acha
by
5.4k points
5 votes

Answer:

str[0].toUpperCase( );

Step-by-step explanation:

This is the correct synthax of calling the toUpperCase function that changes a string from lower case to upper case. the str[0] ensures that only the character at index 0 of the string is so converted.

User Seventoes
by
5.0k points