Question: 1. Write a declaration for a new HashMap called student that has an Integer as the key and a String as the value. Write code
1. Write a declaration for a new HashMap called student that has an Integer as the key and a String as the value. Write code to initialise the new HashMap. Note: you may leave the HashMap empty. (2 marks) 2. The HashMap from the above question will be used a store a student's number as the key and their name as the value. Write Java code to store a student number of 2121212 and a name of "alex". (2 marks) 3. Convert the following code segment into an equivalent while loop (2 marks) for (int i = 0; i
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
