📄 user2.java
字号:
package com.wrox.except;
import java.io.IOException;
public class User2
{
private String username;
private String password;
public User2()
{
}
public void setUsername(String username)
{
this.username = username;
}
public String getUsername()
{
return this.username;
}
public void setPassword(String password)
{
this.password = password;
}
public void validate() throws IOException, Exception
{
if(this.username == null || this.password == null)
{
IOException ioex = new IOException("You must supply a username"
+ " and password!!");
throw ioex;
}
if (!(this.username.equals("Casey")
&& this.password.equals("Kochmer")))
{
Exception trouble = new Exception("Couldn't validate your"
+ " password!");
throw trouble;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -