Java学习之自定义异常
2024-08-24 17:28:21
1 package com.gh;
import java.util.Scanner;
/**
* 自定义异常
* @author ganhang
*
*/
public class ExceptionDemo {
public static void main(String[] args) throws exception {
Scanner sc = new Scanner(System.in);
System.out.println("请输入帐号aaa密码123");
String id = sc.nextLine();
int pwd = sc.nextInt();
if (!id.equals("aaa") || pwd != 123)
throw new exception("帐号或密码错误!");
else System.out.println("帐号正确!");
}
}
class exception extends Exception{
public exception(String mes){
super(mes);
}
}
太久写的,知识点都没记,慢慢上传吧
最新文章
- curl上传图片文件
- 给ubuntu的docky添加可以直接打开的图标
- 进入git diff 界面,无法继续输入命令
- BZOJ 2282 &; 树的直径
- MIFARE系列6《射频卡与读写器的通讯》
- html 页面表单如果是disabled,则不能提交到服务器端,request.getParameter得到的将为null
- TestNG中同一个类中执行多个test()方法如何配置testng.xml
- Bash 小知识点
- CodeForces 299A	 Ksusha and Array
- js中的";==";与";===";的区别
- jQuery EasyUI中常常遇到的问题(FAQ)
- 可伸缩性/可扩展性(Scalable/scalability)
- hdu4497 正整数唯一分解定理应用
- Redis .NET开源组件Beetle.Redis
- Sping--life cycle
- IOS中的JSON数据的解析
- 《Shazam It! Music Recognition Algorithms, Fingerprinting, and Processing》译文
- IO 流小记录
- 使用C#读取网站相对路径文件夹下所有图片
- vue1.0到2.0
热门文章
- android解决内存溢出的问题(没有从根本上解决)
- using的用法
- python把汉字转换成拼音实现程序
- 第八章 C#面向对象编程(Object-Oriented Programming,OOP)简介
- eclipse手动添加源码
- 解决spark运行中failed to locate the winutils binary in the hadoop binary path的问题
- sping+maven+mybatis+ehcache续之实现mapper
- NET Core个人博客
- 我的第一个REST客户端程序!
- viewpager的layout_width=";wrap_content";无效问题