JavaOOP 异常

package exit3Exercise.com;

import java.util.Scanner;

public class Test {

	public static void main(String[] args) {
		Scanner input=new Scanner(System.in);
		System.out.println("请输入课程代号(1~3之间的数字)");
		try {
			int num=input.nextInt();
			if (num==1) {
				System.out.println("c#编程");
			}else if (num==2) {
				System.out.println("java编程");
			}else if (num==3){
				System.out.println("SQL基础");
			}
		} catch (Exception ex) {
			System.out.println("请输入整数");
         	ex.printStackTrace();
		}finally{
			System.out.println("欢迎提出建议");
		}
		
		

	}

}

你可能感兴趣的:(JavaOOP 异常)