Quiz: The replace Method
Here is the Java 7 String documentation: http://docs.oracle.com/javase/7/docs/api/java/lang/String.html
Consider the variable declaration
String river = "Mississippi";
Write the method call that replaces “i”s in the variable river with “x”s |
river.replace("i", "x") |
We want to replace each string "i" with "x". |
| What is the return value? | "Mxssxssxppx" |
That's the string that the method call returns—"Mississippi" with each i turned into an x. |