Put Items
You can associate a key with a value by calling the .put
method.1
import java.util.HashMap;
class Main {
void main() {
var wins = new HashMap<String, Integer>();
wins.put("Lightning McQueen", 2);
wins.put("Tow Mater", 0);
System.out.println(wins);
}
}
1
Cars was a delightful movie. Go to your local second hand store, get a copy on DVD, and make a night of it.