try{
}catch(){
}finally{
}
例:
private int chooseMenu() {
Scanner scan = new Scanner(System.in);
System.out.println("请选择操作:");
System.out.println("1: 查询余额");
System.out.println("2: 存款");
System.out.println("3: 取款");
System.out.println("4: 转账");
System.out.println("5: 修改密码");
System.out.println("6: 退出,重新登录");
System.out.println("7: 退出系统");
System.out.println("请输入您的操作:");
int a = 0;
try {
a = scan.nextInt();
} catch (InputMismatchException ime) {
} catch (Exception ex) {
ex.printStackTrace();
}
return a;
}