Map Interface in Java


The Map interface maps keys to values, with unique keys mapping to individual values, great for key-value association.

Source Code

Map map = new HashMap();
map.put("Alice", 25);
map.put("Bob", 30);
System.out.println(map.get("Alice")); // Outputs: 25
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments