/* package whatever; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ class Ideone { // initializing running variables here to reuse in "display hashmap" loop int key = 48; int values = 65; // set keys and values to hashmap via nested for-loop for (key = 48; key < 74 && values < 91; key++) { hMap.put(key, values); values++; } // display hashmap via nested for-loop for (key = 48; key < 74; key++) { } } }
Standard input is empty
Key: 48, Value: 65 Key: 49, Value: 66 Key: 50, Value: 67 Key: 51, Value: 68 Key: 52, Value: 69 Key: 53, Value: 70 Key: 54, Value: 71 Key: 55, Value: 72 Key: 56, Value: 73 Key: 57, Value: 74 Key: 58, Value: 75 Key: 59, Value: 76 Key: 60, Value: 77 Key: 61, Value: 78 Key: 62, Value: 79 Key: 63, Value: 80 Key: 64, Value: 81 Key: 65, Value: 82 Key: 66, Value: 83 Key: 67, Value: 84 Key: 68, Value: 85 Key: 69, Value: 86 Key: 70, Value: 87 Key: 71, Value: 88 Key: 72, Value: 89 Key: 73, Value: 90