
"FOLLOWING IS MY LAST QUESTION ON JAVA I/O OPERATIONS the ANSWER WAS POSTED THANKS FOR POSTING IT WORKS WELL WITH BUFFERED STREAM BUT IT IS NOT WORKING WELL WITH RANDOM ACCESS FILE" i.e.,how to WRITE integer data to the file using random access file.
""how to write integer data to a file in java using random access file object or file writer or data outputstream i have already tried the write and writeInt methods....plz help""
import java.io.*; import java.util.*; class AcceptNumbers{ public static void main(String[] args)throws Exception{ Scanner input=new Scanner(System.in); BufferedWriter bw=new BufferedWriter(new FileWriter(new File("C:/numbers.txt"),true)); for(int i=1;i<=10;i++){ System.out.print("Enter Number "+i+": "); int num=input.nextInt(); bw.write(Integer.toString(num)); bw.newLine(); } bw.close(); System.out.println("Numbers are store into the file"); } }help"
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.