import java.io.*;
class FileReadDemo3
{
public static void main(String[] args)
{
FileReader t=null;
try
{
t=new FileReader("DateDemo.java");
char[] in=new char[1024];
int ch=0;
while((ch=t.read(in))!=-1)
{
System.out.println(new String(in,0,ch));
}
}
catch (IOException e)
{
System.out.println(e.toString());
}
finally
{
if(t!=null);
try
{
t.close();
}
catch (IOException e)
{
System.out.println(e.toString());
}
}
}
}
|
|