Solución:
Puedes hacerlo:
Scanner s = new Scanner(System.in);
while (s.hasNextInt()) {
A[i] = s.nextInt();
i++;
}
// assuming that reader is an instance of java.io.BufferedReader
String line = null;
while ((line = reader.readLine()) != null) {
// do something with every line, one at a time
}
Avísame si tienes dificultades.
import java.io.BufferedReader;
import java.io.FileReader;
BufferedReader br = null;
br = new BufferedReader(new FileReader(file));
while ((line = br.readLine()) != null) {
}
//using Scanner class
Scanner scanner = new Scanner(file);
while (scanner.hasNextLine()) {
String line = scanner.nextLine();
System.out.println(line);
}
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)