Advertisement
Guest User

Untitled

a guest
Dec 7th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. public class Main {
  2.  
  3. public static void main(String[] args) {
  4. int[] arr = new int[6];
  5. BufferedReader reader = null;
  6. int counter = 0;
  7. try {
  8. reader = new BufferedReader(new FileReader("C:\\Users\\gzero\\OneDrive\\Desktop\\lab stuff.txt"));
  9. String text = null;
  10. while ((text = reader.readLine()) !=null)
  11. {
  12. arr[counter]=Integer.parseInt(text);
  13. counter++;
  14. }
  15. } catch (FileNotFoundException e) {
  16. e.printStackTrace();
  17. System.out.println("lab stuff.txt doesn't exist");
  18. } catch (IOException e) {
  19. e.printStackTrace();
  20. }
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement