java读取txt有乱码!!求解决!!
import java.io.BufferedReader;import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
public class Daone {
public static void main(String[] args) {
File file = new File("www.txt");
try {
FileReader f = new FileReader(file);
BufferedReader reader = new BufferedReader(f);
String str = reader.readLine();
while (str != null) {
System.out.println(str);
str = reader.readLine();
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
读取的文件出来有乱码现象,求高手指教!!!谢谢!!
----------------解决方案--------------------------------------------------------