1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
// Test of failing method invocation. public class Invoke_1 { public void call_me () { System.out.println ("no"); } public static Invoke_1 get_i () { return null; } public static void main (String[] args) { Invoke_1 i = get_i (); try { i.call_me (); } catch (NullPointerException ok) { System.out.println ("ok"); } } }