SHARE
TWEET

no idea java file io

eyitsmerubi Dec 23rd, 2018 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package cmpe211lab7hw3;
  2.  
  3. import java.io.*;
  4.  
  5. public class Ugur {
  6.  
  7.     public static void main(String args[]) throws IOException {  
  8.         FileOutputStream out = null;
  9.        
  10.         int[] arr = new int[100];
  11.        
  12.         for (int i = 0; i < 100; ++i) {
  13.             arr[i] = (int) (Math.random() * 101);
  14.         }
  15.  
  16.         try {
  17.             out = new FileOutputStream("Example.txt");
  18.             int c;
  19.             for (int i = 0; i < 100; ++i) {
  20.                 out.write(arr[i]);
  21.             }
  22.         } finally {
  23.              if (out != null) {
  24.                 out.close();
  25.              }
  26.         }
  27.     }
  28. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top