-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHashMapping.java
More file actions
33 lines (23 loc) · 844 Bytes
/
Copy pathHashMapping.java
File metadata and controls
33 lines (23 loc) · 844 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
32
33
import java.util.HashMap;
class CarMileage{
public static void miles(){
HashMap<String, Integer> mileage = new HashMap<String, Integer>();
mileage.put("Honda", 12435);
mileage.put("Hyundai", 64266);
mileage.put("Ford", 12482);
mileage.put("Toyota", 164335);
mileage.remove("Hyundai");
mileage.put("Mercury", 21685);
mileage.put("Saturn", 264016);
mileage.remove("Mercury");
mileage.put("Tesla", 61200);
System.out.print(mileage + "\n");
System.out.println("The Ford has " + mileage.get("Ford") + " on it.");
}
}
public class HashMapping{
public static void main(String[] args){
CarMileage a = new CarMileage();
a.miles();
}
}