JOptionPane&&Exception的使用
来源:互联网 发布:arw格式怎么打开 mac 编辑:程序博客网 时间:2024/04/29 17:36
import java.util.Scanner;import javax.swing.JOptionPane;class AgeException extends Exception{AgeException(){JOptionPane.showMessageDialog(null, "您输入了非法年龄","输入错误",JOptionPane.WARNING_MESSAGE);}}public class Student_Age {private int age = 1;public void setAge(int age) throws AgeException{if(age < 0 || age > 160){throw new AgeException();}else{this.age = age;}}public static void main(String[] args) {Scanner cin = new Scanner(System.in);int x = cin.nextInt();Student_Age student_Age = new Student_Age();try {student_Age.setAge(x);} catch (AgeException e) {}}}
- JOptionPane&&Exception的使用
- JOptionPane对话框的使用
- JOptionPane.showMessageDialog的使用
- JOptionPane提示对话框的使用
- java中JoptionPane类的使用
- java中JOptionPane类的使用
- java中JoptionPane类的使用
- java中JOptionPane类的使用
- 学习使用JOptionPane(1)
- JOptionPane.showInputDialog & JOptionPane.showConfirmDialog & showMessageDialog的应用
- java中JoptionPane 的一些常用使用规范
- JOptionPane类的心得
- JOptionPane的应用
- JOptionPane类的用法。
- JOptionPane类的导入
- JOptionPane的常见用法
- JOptionPane
- JOptionPane
- 如何让IOS应用从容地崩溃
- 远程上线脚本
- 运用autoconf和automake自动生成Makefile实例讲解
- 遇见未知的自己 张德芬
- 微信或百度私信的效果
- JOptionPane&&Exception的使用
- linux下用gcc生成静态库和动态库
- implicit declaration of function 'class_device_create'
- CentOS 中安装Qemu记录
- Linux下各类TCP网络服务器的实现源代码
- 加快itunes访问下载速度
- 网页测试方法
- Java与Win32多线程
- C++ 操作符重载、友元、类型转换操作符、五种类型转换、函数操作符(一)