Skip to content

Instantly share code, notes, and snippets.

@ZhdanRuslan
Created April 24, 2015 18:00
Show Gist options
  • Save ZhdanRuslan/4e3cc9a7839f515399e7 to your computer and use it in GitHub Desktop.
Save ZhdanRuslan/4e3cc9a7839f515399e7 to your computer and use it in GitHub Desktop.
com.javarush.test.level09.lesson06.task05
package com.javarush.test.level09.lesson06.task05;
import java.util.HashMap;
/* Исключение при работе с коллекциями Map
Перехватить исключение (и вывести его на экран), указав его тип, возникающее при выполнении кода:
HashMap<String, String> map = new HashMap<String, String>(null);
map.put(null, null);
map.remove(null);
*/
public class Solution
{
public static void main(String[] args) throws Exception
{
try{
HashMap<String, String> map = new HashMap<String, String>(null);
map.put(null, null);
map.remove(null);
} catch (NullPointerException exc){
System.out.println(exc);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment