public class Solution { private static final String THIS_IS_FILE = " - это файл"; private static final String THIS_IS_DIR = " - это директория"; public static void main(String[] args) { Scanner scanner = new Scanner(System.in); while (scanner.hasNext()) { String str = scanner.nextLine(); if (Files.exists(Path.of(str))){ if (Files.isRegularFile(Path.of(str))) { System.out.println(str + THIS_IS_FILE); } else if (Files.isDirectory(Path.of(str))) { System.out.println(str + THIS_IS_DIR); } }else scanner.close(); } } }