中文友好
port java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; public class demo { public static void main(String[] args) throws IOException { //定义文件路径 String str1="C:\\Users\\Administrator\\Desktop\\id.txt"; //常见字符输入流资源 FileReader fr1 = new FileReader(str1); int ten=0; while ((ten=fr1.read())!=-1){ //读取文件并打印 System.out.print((char)ten); } //释放系统资源 fr1.close(); } }