Guest User

Untitled

a guest
Feb 22nd, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. package uscrimedata;
  2.  
  3. import java.io.BufferedReader;
  4. import java.io.FileReader;
  5. import java.io.IOException;
  6. import java.util.Scanner;
  7. import java.io.FileInputStream;
  8.  
  9. public class USCrimeData {
  10. public static void main(String[] args) {
  11.  
  12. int[] crime = new int[20];
  13. int i = 0;
  14.  
  15. BufferedReader inputStream = null;
  16. FileInputStream in = null;
  17. Scanner scannerIn = null;
  18.  
  19. try {
  20. inputStream = new BufferedReader(new FileReader("Crime.csv"));
  21. scannerIn = new Scanner(inputStream);
  22.  
  23. for (i = 0; i < 20; i++) {
  24. crime[i] = scannerIn.nextInt();
  25. }
  26. }
  27.  
  28. catch (IOException io) {
  29. io.getMessage();
  30. }
  31.  
  32. finally {
  33.  
  34. try {
  35. if (inputStream != null) {
  36. inputStream.close();
  37. }
  38. }
  39.  
  40. catch (IOException io) {
  41. io.getMessage();
  42. }
  43.  
  44. }
  45. }
Add Comment
Please, Sign In to add comment