String text = " Hello, Java 11\n New Features"; String stripped = text.stripIndent(); System.out.println(stripped);B.
String text = " Hello, Java 11\n New Features"; String stripped = text.trimIndent(); System.out.println(stripped);C.
String text = " Hello, Java 11\n New Features"; String stripped = text.strip(); System.out.println(stripped);D.
String text = " Hello, Java 11\n New Features"; String stripped = text.trim(); System.out.println(stripped);
String content = Files.readString(Paths.get("file.txt"), StandardCharsets.UTF_8); System.out.println(content);B.
String content = readStringFromFile("file.txt"); System.out.println(content);C.
String content = readFileToString("file.txt"); System.out.println(content);D.
String content = new String(Files.readAllBytes(Paths.get("file.txt"))); System.out.println(content);