Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.DataOutputStream;
- import java.io.FileOutputStream;
- public class Zahlen {
- public static void main(String[] args) {
- int n = 50;
- try {
- FileOutputStream f1 = new FileOutputStream("C:/Test/zahlen.txt");
- for (int i = 1; i <= n; i++) {
- int random = (int) ((Math.random() * 100) + 1);
- System.out.println(random);
- f1.write(random);
- }
- f1.flush();
- f1.close();
- } catch (Exception e) {
- System.out.println(e.getMessage());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement