if ("expired".equals(username)) {
throw new ExpiredPasswordException(username);
}
请问这个equals在这里是怎么理解?
比较两个字符串的内容是不是一样
// Force an application-specific exception which can be handled
if ("expired".equals(username)) {
throw new ExpiredPasswordException(username);
}
首先判断两个字符串是否相等,如果相等创造一个异常对象,并由这个对象抛出异常
if your parameter usernames value is expired,then throws a Exception,this Exception class named ExpiredPasswordException may be written by yourself which should extend Exception class.
要是一样就抛出一个异常。