传值有问题!
public static void stringReplace (String text) {
 text = text.replace ('j' , 'i');
          System.out.println(text);
 }
此时打印出来的数据就是替换了的!
有空看看:
http://www.csdn.net/Develop/read_article.asp?id=22025

解决方案 »

  1.   

    If the character oldChar does not occur in the character sequence represented by this String object, then a reference to this String object is returned. Otherwise, a new String object is created that represents a character sequence identical to the character sequence represented by this String object, except that every occurrence of oldChar is replaced by an occurrence of newChar.
      

  2.   

    使用replace方法如果发生了替换,
    replace方法是说:如果在string中找到欲替换的字符,则会产生一个新的与原字符串内容相同的字符串,返回该字符串被替换后的结果。并不像其他语言一样对原字符串进行替换。所以你打印原字符串自然没有变化参照下例:
    public class Test {
     public static String stringReplace (String text) {
    return text.replace ('j' , 'i');
     } public static void main (String args[]) {  String textString = new String ("java");
     System.out.println(stringReplace (textString));
     System.out.println (textString);
     }
     }