Advertisement
kuchuz

PBO-C 4 : HashMap()

Nov 16th, 2020
465
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.34 KB | None | 0 0
  1. import java.util.*;
  2.  
  3. public class HashMapContoh{
  4.     public static void main (String args[]){
  5.         HashMap<Integer,String> hm = new HashMap<Integer,String>();
  6.         hm.put(100,"Fajar");
  7.         hm.put(101,"Satria");
  8.         hm.put(102,"Budi");
  9.         hm.put(null,"Novi");
  10.         for(Map.Entry m:hm.entrySet()){
  11.             System.out.println(m.getKey()+" "+m.getValue());
  12.         }
  13.     }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement