/
GermanezZ
/
JavaExercises
Обзор
Документация
Войти
/
GermanezZ
/
JavaExercises
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
AllMetanitLessons/InputOutoutStreamsFolder/Default/InputClass.java
64 строки
2 KB
germa
Уроки по Metanit
04 дек 2024, 20:39
04 дек 2024, 20:39
48d575a
Код
Авторство
О чём код?
package AllMetanitLessons.InputOutoutStreamsFolder.Default; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; public class InputClass { public static void main(String[] args) { try (FileInputStream fin = new FileInputStream("D://Files//Exema.txt")) { System.out.printf("The size is %d\n", fin.available()); int i; while ((i = fin.read()) != -1) { System.out.print((char) i); } } catch (IOException exc) { System.out.println(exc.getMessage()); } ////////////////////////////////////////// /*FileInputStream fin = null; try { fin = new FileInputStream("D://Files//Exema.txt"); System.out.printf("The size is %d\n",fin.available()); int i; while ((i = fin.read())!= -1){ System.out.print((char) i); } }catch (IOException exc){ System.out.println(exc.getMessage()); }finally { try{ if (fin != null) fin.close(); }catch (IOException exc){ System.out.println(exc.getMessage()); } }*/ ////////////////////////////////////////// /* try(FileInputStream fin = new FileInputStream("D://Files//Exema.txt")){ int i; while ((i = fin.read())!=-1){ System.out.print((char) i); } }catch (IOException exc){ System.out.println(exc.getMessage()); }*/ } }