Question: What you need to do: Write and test the method public static String capitalize (String str) which takes a string argument and returns a

What you need to do: Write and test the method public static String capitalize (String str) which takes a string argument and returns a new String consisting of str, with the first character in uppercase and all the remaining characters in lowercase. Non-letter characters are unaffected. Here are some examples: str "bobby" "ILENE" "YOU-tubER" "133t haXXor" "3-Point shot" value returned by capitalize (str) "Bobby" "Ilene" "You-tuber" "L33t haxxor" "3-point shot" Once again, this method is somewhat easier to write if you use the substring method, but can be accomplished (a bit more awkwardly, I'll admit) by using a combination of a for loop, the toCharArray, charAt, toUpperCase, toLowerCase, and String constructor methods.
Step by Step Solution
There are 3 Steps involved in it
Heres the implementation of the capitalize method in Java that capitalizes the first character of a string and converts the remaining characters to lo... View full answer
Get step-by-step solutions from verified subject matter experts
Document Format (2 attachments)
661e87dacd89d_880229.pdf
180 KBs PDF File
661e87dacd89d_880229.docx
120 KBs Word File
