My Java Learning Path (the thirteenth day) ------ whether the string can be modified (modified string problem)

The problem is no doubt that the answer is no! ! !

We know that the string provides a method to convert toUpperCase and tolowerCase-sensitive, but it does not mean that the string can be modified;

However a very useful method is to use replace, it can find and replace a specified string in the string. For example, the following code talk "aaa" is replaced with "bbb";

package demo1;

public class Test {
	public static void main(String[] args) {
		String text = "aaa";
		text = text.replace("aaa", "bbb");
		System.out.println(text);
	}
}

Published 31 original articles · won praise 42 · views 5351

Guess you like

Origin blog.csdn.net/solitudi/article/details/104038618