@SpringBootApplication public class MyApplication { public static void main(String[] args) { SpringApplication.run(MyApplication.class, args); } } @RestController @RequestMapping("/api") public class MyController { @GetMapping("/hello") public String sayHello() { return "Hello, World!"; } } import java.io.File; import java.io.FileReader; import java.io.IOException; public class MyApplication { public static void main(String[] args) { File file = new File("data.txt"); try (FileReader reader = new FileReader(file)) { char[] buffer = new char[1024]; int length = reader.read(buffer); System.out.println(new String(buffer, 0, length)); } catch (IOException e) { e.printStackTrace(); } } }


上一篇:
下一篇:
切换中文