-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOther3.java
More file actions
31 lines (24 loc) · 896 Bytes
/
Other3.java
File metadata and controls
31 lines (24 loc) · 896 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package java_exercises_others;
import java.util.HashMap;
import java.util.Map;
public class Other3 {
public static Map<Integer, String> mapExercise() {
Map<Integer, String> mapOfNames = new HashMap<>();
mapOfNames.put(1, "Monika");
mapOfNames.put(2, "Beata");
mapOfNames.put(3, "Krzyś");
System.out.println("Mapa: " + mapOfNames.size());
System.out.println(mapOfNames.get(1));
mapOfNames.put(1, "Maciek");
System.out.println("Mapa: " + mapOfNames.size());
System.out.println(mapOfNames.get(1));
return mapOfNames;
}
public static void main(String[] args) {
Map<Integer, String> familyMap = mapExercise();
System.out.println("START");
System.out.println(familyMap.get(1));
System.out.println(familyMap.get(2));
System.out.println(familyMap.get(3));
}
}