zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    JavaWeb——Servlet开发3
    8.3.3
    8.3.2
    8.3
    8.2
    8.1
    7.3.9
    7.3.8.3
    7.3.8.2
    7.3.8.1
  • 原文地址:https://www.cnblogs.com/qiangini/p/13399585.html
Copyright © 2011-2022 走看看