/
GermanezZ
/
JavaExercises
Обзор
Документация
Войти
/
GermanezZ
/
JavaExercises
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
AllMetanitLessons/InputOutoutStreamsFolder/Print_WriteStreams/ClassPrintWrites.java
28 строк
829 B
germa
Уроки по Metanit
04 дек 2024, 20:39
04 дек 2024, 20:39
48d575a
Код
Авторство
О чём код?
package AllMetanitLessons.InputOutoutStreamsFolder.Print_WriteStreams; import java.io.*; public class ClassPrintWrites { public static void main(String[] args) { try(FileOutputStream fos = new FileOutputStream("D://Files//notes.txt",false); PrintWriter printWriter = new PrintWriter(fos)) { printWriter.println("Hello, German, it's me!"); printWriter.println("Welcome to Java"); printWriter.printf("My name is %s, I am %d","German",21); printWriter.println(); String message = "PrintStream"; printWriter.write(message); printWriter.write('h'); System.out.println("The File has been written!"); }catch (IOException exc){ System.out.println(exc.getMessage()); } } }