一、增删改查
ArrayList和LinkedLIst的不同
异常
package text;
class Exception extends RuntimeException {
public Exception() {
super(“自定义一个异常类”);
}
}
class ConnectionServer {
private final String ID = “123456”;
private final String password = “guoxiao”;
public void connect(String ID, String password) throws Exception {
if (this.ID != ID || this.password.equals(password)) {
throw new Exception();
}
}
}
class LoginText {
public static void main(String[] args) {
LoginText laozhu = new LoginText();
laozhu.login(“556ssa”, “553xha”);
}
public void login(String ID, String password) {
ConnectionServer connectionServer = new ConnectionServer();
try {
connectionServer.connect(ID, password);
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
}