import java.io.FileInputStream;
import java.io.FileOutputStream;
class FileInput
{
public static void main(String args[])
{
try{
FileOutputStream fout= new FileOutputStream("a.txt");
FileInputStream fin=new FileInputStream("a.txt");
String str="1234";
byte a[]=str.getBytes();
fout.write(char(a));
fout.close();
int i=0;
while((i=fin.read())!=-1)
{
System.out.println((i));// This is printing in ascii value i want to display as string
}
fin.close();
}
catch(Exception e)
{
System.out.println(e);
}
}
}
答案 0 :(得分:-1)
try{
FileOutputStream fout= new FileOutputStream("a.txt");
FileInputStream fin=new FileInputStream("a.txt");
String str="1234";
byte a[]=str.getBytes();
fout.write(a);
fout.close();
int i=0;
while((i=fin.read())!=-1)
{
System.out.println((char)i);
}
}