Code example for SocketPermission

0
        } catch (IllegalArgumentException iae) {
            System.out.println("Expected IllegalArgumentException thrown");
        } 
 
        try { 
            sp = new SocketPermission("localhost", null);
            throw new Exception("Expected NullPointerException not "
                                + "thrown"); 
        } catch (NullPointerException npe) {
            System.out.println("Expected NullPointerException thrown");
        } 
    } 
}