package cn.mldn.demo; import java.io.File; import java.io.FileReader; import java.io.Reader; public class TestDemo { public static void main(String[] args) throws Exception{ File file=new File(“e:”+File.separator+”hello,world”+File.separator+”my.txt”); if(file.exists()){ Reader reader=new FileReader(file); char Char[]=new char[1021]; int temp=0; int foot=0; while((temp=reader.read())!=-1){ Char[foot++]=(char)temp; } System.out.println(new String(Char,0,foot)); } } }
转载请注明原文地址: https://ju.6miu.com/read-1309571.html