java学习24天2020/7/29
一.
import java.util.Scanner; public class Demol { public static void main (String [] args) { Scanner in=new Scanner(System.in); while(true) { System.out.print("1 堆溢出2 栈溢出"); String str =in.nextLine(); if(str.equals("1")) { char[] chs=new char[0x7fffffff]; } else if(str.equals("2")) { f(); } } } public static void f() {f();} }
public class A { public void method1 throws Excetpion { //可能有一个SQLException } } //调用类捕获异常 public class B { private A a; try { a.method1(); } catch(Exception e) { System.out.println(e); } }
二.没什么问题
三12