2017-09-19 5 views
-1
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

はこの試してください: 'のSystem.out.println(新しい文字((チャー)私は));' –

+1

は 'FOUTをい.write(char(a)); 'あなたのために働く? – nullpointer

答えて

-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); 
} 

}

関連する問題