In Java, Write And Read 100 Random Integers From File
import java.io.PrintStream;
public class Ex3{
public static void main(String[]args){
try(PrintStream out = new PrintStream(new java.io.File("numbers.txt"))){
int i = 100;
while(0 < i --)
out.println((int)(1+Math.random()*10000));
}catch(java.io.IOException e){
System.err.println(e.getMessage());
}
}
}
Download
Comments
Post a Comment