package com.study.demo3; import java.util.*; public class StudentManager { public static void main(String[] args) { List studentNames = new ArrayList<>(); Map studentScores = new HashMap<>(); studentNames.add("张三"); studentNames.add("李四"); studentNames.add("王五"); studentScores.put("张三", 85); studentScores.put("李四", 77); studentScores.put("王五", 99); System.out.println("--- 所有学生姓名 ---"); for (String name : studentNames) { System.out.println(name); } studentScores.put("张三", 70); Integer zhangsanScore = studentScores.get("张三"); System.out.println("\n--- 修改后张三的成绩 ---"); System.out.println("张三的成绩: " + zhangsanScore); } }