-1
我想要一個字符串使用另一個類的方法來將某個字符更改爲不同的字符。但是,當我運行我的程序沒有任何反應。如何從另一個類的方法中更改某些字符?
在我的主類,我有:
String example = "example";
Pears.mToX(example);
System.out.println(example);
,在我所謂的「Pears.java」第二類我:
public static void mToX(String word){
word.replace("m", "x");
}