Advertisement
Guest User

Untitled

a guest
Nov 29th, 2015
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. public static void readVotesFileInfo() throws FileNotFoundException {
  2. Scanner scanner = new Scanner (System.in);
  3. System.out.println("Qual é o nome do ficheiro?");
  4. String fileName = scanner.nextLine();
  5. File f = new File(fileName);
  6. int nlinhas = 0;
  7. Scanner fInput = new Scanner(f);
  8. String[]votes = new String[Main.MAX_DEPUTADOS];
  9. while (fInput.hasNext() && nlinhas < Main.MAX_DEPUTADOS) {
  10. String line = fInput.nextLine();
  11. if (line.length() == 6){
  12. votes[nlinhas] = line.substring(line.length()-1);
  13. nlinhas++;
  14. }
  15. }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement