190k views
0 votes
Which of the following is not a method of class String?

a. toUpperCase
b. trim
c. toCharacterArray
d. All of the above are methods of class String

User Igelkott
by
8.6k points

1 Answer

4 votes

Final answer:

The method not part of the class String is 'toCharacterArray.' The correct method name is 'toCharArray.' Methods like 'toUpperCase' and 'trim' are indeed part of String's methods.

Step-by-step explanation:

The method that is not a method of the class String is c. toCharacterArray. The String class in Java provides a range of methods to manipulate and handle string data. Methods such as toUpperCase() and trim() are part of the String class. The method to convert a string to a character array is correctly named toCharArray(), not toCharacterArray.

User Dule
by
7.3k points