L11.7: Maps Methods Example #4

PHOTO EMBED

Thu Oct 19 2023 01:57:35 GMT+0000 (Coordinated Universal Time)

Saved by @testpro #java

import java.util.HashMap;

public class Main {
    public static void main(String[] args) {

        HashMap<String, String> countryCapitals = new HashMap<>();
        countryCapitals.put("France","Paris");
        countryCapitals.put("Italy", "Rome");
        countryCapitals.put("Norway", "Oslo");
        countryCapitals.put("US", "Washington DC");

        System.out.println( countryCapitals.values());
    }
}
// Output: [Oslo, Rome, Paris, Washington DC]
content_copyCOPY