Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int cuenta = 0;
- try (Scanner fichero = new Scanner(new BufferedReader(new FileReader("poema.txt")))) {
- while (fichero.hasNext()) {
- String token = fichero.next();
- cuenta++;
- }
- } catch (IOException ex) {
- System.err.println("Excepción de lectura");
- ex.printStackTrace();
- }
- System.out.format("Palabras %d%n", cuenta);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement