1 // Copyright (c) 2017, the R8 project authors. Please see the AUTHORS file 2 // for details. All rights reserved. Use of this source code is governed by a 3 // BSD-style license that can be found in the LICENSE file. 4 5 public class Exceptions { 6 catchException()7 private static void catchException() { 8 try { 9 throwNullPointerException(); 10 } catch (NullPointerException e) { 11 System.out.println("Caught NPE"); 12 } 13 } 14 throwNullPointerException()15 private static void throwNullPointerException() { 16 throw new NullPointerException(); 17 } 18 main(String[] args)19 public static void main(String[] args) { 20 catchException(); 21 } 22 } 23