Demo04.java 691 B

12345678910111213141516171819202122232425262728293031323334353637
  1. package com.four.day12.demo02;
  2. import java.io.FileInputStream;
  3. import java.io.FileNotFoundException;
  4. public class Demo03 {
  5. public static void main(String[] args) {
  6. //
  7. try {
  8. //int i= 1/0; // ArithmeticException
  9. //String s = null; //NullPointerException
  10. //s.equals("1");
  11. int[] arr= new int[1];
  12. arr[1] = 0;
  13. }
  14. // catch (ArithmeticException e1){
  15. // e1.printStackTrace();
  16. // }catch ( NullPointerException e2 ){
  17. // e2.printStackTrace();
  18. // }
  19. catch (RuntimeException e3){
  20. //范围
  21. e3.printStackTrace();
  22. }
  23. }
  24. }