import *;
public class IODemo4
{
public static void main(String[] args)
{
try
{
File file
= new File ("f:\\java\\source.txt");
int sizeL
= (int)file.length();
int chars_read
=
0;
BufferedReader in =new BufferedReader( new FileReader("f:\\java\\source.txt"));
char[]
data
=
new
char[sizeL];
while(in.ready())
{
chars_read
+=
in.read(data,
chars_read,
sizeL
-
chars_read);
}
String
temp="";
for(int
j=0;j<chars_read;j++)
temp+=data[j];
String
newtemp=temp.replace("tihuan","g");
in.close();
PrintWriter out =new PrintWriter(
new FileWriter("f:\\java\\destnation1.txt"));
out.println(newtemp);
out.close();
}
catch(Exception e) {}
}
}
为什么字符没有替换呢?