| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | import java.util.*; public class Main {     public static void main(String[] args) throws Exception {         List<オリンピック> ships = new ArrayList<>();         ships.add(new オリンピック("オリンピック"));         ships.add(new オリンピック("タイタニック"));         ships.add(new オリンピック("ブリタニック"));         ships.forEach(ship -> System.out.println(ship));     } } class オリンピック {     public String name;     public オリンピック (String name) {         this.name = name;     }     @Override     public String toString() {         return "この艦はオリンピック級" + this.name + "号です";     } } | 
| 1 2 3 | この艦はオリンピック級オリンピック号です この艦はオリンピック級タイタニック号です この艦はオリンピック級ブリタニック号です | 



