Question: In Java using NETBEANS Create a method called capFirst that will capitalize the first character of every word in a String Your method should take

In Java using NETBEANS

In Java using NETBEANS Create a method called capFirst that will capitalize

Create a method called capFirst that will capitalize the first character of every word in a String Your method should take as a parameter the String to search through Your method should also return the number of characters converted NOTE teyenson, MisJo For simplicity sake assume that words in the string are separated by one space character. Strings in Java are immutable. This means that they cannot simply be modified That poses a problem for this exercise To get around it here is a method called replace that will replace a character in a string by converting the string to a character array, replacing the character, then converting it back to a string Tensor, SJC public String replace(String str, int index, char replace)t if(str--null) return str; Jelse if(indexce I index>-str.length) return str; char[] chars -str.toCharArray); chars [index] = replace; return String.valueOf (chars); Glenn Stey This code can be used in the following manner String s "Now is the time"; s -this.replace(s, 0, 'Z); System.out.println(s); The above code changes the first character in the string to N

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!