
Write a program in Java to accept 10 different numbers an store it in text file.

Hi Friend,
Try this:
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");
}
}
Thanks
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.