import java.io.*;
import java.math.*;
class jReadWrite
{ public static void main(String args[])
{
DataInputStream dis=null;
DataOutputStream dos=null;
File inFile=new File("rand.txt");
try //Writing Content into File
{
dos=new DataOutputStream(new FileOutputStream(inFile));
for(int i=0;i<=20;i++)
{
dos.writeInt((int)i);
}
}catch(Exception e){}
try //Reading Content from File
{
dis=new DataInputStream(new FileInputStream(inFile));
for(int i=0;i<=20;i++)
{
int n=dis.readInt();
System.out.print(n+" ");
}
}catch(Exception ex){}
try // Closing File
{
dis.close();
dos.close();
}catch(Exception ey){}
}
}
Comments
Post a Comment