Текст печатает в бесконечном цикле. Любой способ избежать этого?Печать текста в бесконечном цикле
if (eLoad) {
File file = new File("reservation.txt");
/** reading a file */
try(FileInputStream fis = new FileInputStream(file)) {
int content;
while ((content = fis.read()) != -1) {
// convert to char and display it
System.out.print((char) content);
/**print out the result contents of the file. */
}
}
catch(IOException e) {
e.printStackTrace();
}
}
Ooutput показано
Homeworkdue Сб 10 октября 2015 00:00:00 PDT 23:00 23
Homeworkdue Сб 10 октября 2015 00:00:00 PDT 23:00 23
Homeworkdue сб 10 октября 00:00:00 PDT 2015 23:00 23
Какое содержимое содержит ваши текстовые файлы? –
ЗДЕСЬ ЛИНИЯ ДЛЯ РЕШЕНИЯ ЭТИХ ПРОБЛЕМ http://stackoverflow.com/questions/731365/reading-and-displaying-data-from-a-txt-file –