初期設定では右側にあるが、下記のとおり下に配置したい
設定
more options...
IDE Layout の message are at bottom にチェック
Commad + o
/data/data.txt
Hello World!
file = open("./data/data.txt") text = file.read() file.close() print(text)
Hello World!
# with open()構文でファイルを開くと、ファイルの入出力が、構文内だけで実行される # 明示的にファイルオープンが完了するので、閉じ忘れの心配がない。 with open("./data/data.txt") as file: print(file.read())
package com.tanakahda.apps.generics; public class GenericsExample<T> { private T value; public T getValue() { return value; } public void setValue(T value) { this.value = value; } public GenericsExample(T value) { this.value = value; } }
package com.tanakahda.apps.generics; public class Main { public static void main(String[] args) { GenericsExample<String> hoge = new GenericsExample<String>("Hello"); System.out.println(hoge.getValue()); GenericsExample<Integer> foo = new GenericsExample<Integer>(100); System.out.println(foo.getValue()); } }
Hello 100
HelloController.java
package com.example.demo.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @Controller public class HelloController { @RequestMapping("/") public String index() { return "hello"; } }
hello.html
<!DOCTYPE html> <html xmlns:th="http://www.thymeleaf.org"> <head> <meta charset="UTF-8"> <title>Hello World</title> </head> <body> <h2>Hello World</h2> </body> </html>
package com.tanakahda.apps.record; public record Vehicle(int gas) { }
package com.tanakahda.apps; import com.tanakahda.apps.record.Vehicle; public class Main { public static void main(String[] args) { var car = new Vehicle(60); System.out.println(car.gas()); } }
60