Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Map<String, String> map= new HashMap<>();
- String value;
- value=map.get(null);
- System.out.println(value); // null - there is no pair with key==null
- map.put(null, "Hello");
- value=map.get(null);
- System.out.println(value); // Hello - now there is a value with key = null
- map=null;
- value=map.get(null); // NPE - do not follow the null pointer!!
Advertisement
Add Comment
Please, Sign In to add comment