replace 和 replaceAll 小题目

		String temp = "a\nbc"; 
        String temp1;
        String temp2;
        temp1 = temp.replace("\n","\\n");
        temp2 = temp.replaceAll("\n","\\n");
        
        System.out.println(temp);
        System.out.println(temp1);
        System.out.println(temp2);
posted @ 2018-04-11 11:20  南村一哥  阅读(134)  评论(0编辑  收藏  举报