Why do I have to declare the constants static also? I don't understand.
public class Solution {
public final class Constants {
public static final String SERVER_IS_CURRENTLY_NOT_ACCESSIBLE = "The server is currently not accessible.";
public static final String USER_IS_NOT_AUTHORIZED = "The user is not authorized";
public static final String USER_IS_BANNED = "The user is banned";
public static final String ACCESS_IS_DENIED = "Access is denied";
}
public class ServerNotAccessibleException extends Exception {
public ServerNotAccessibleException() {
super("The server is currently not accessible.");
}
public ServerNotAccessibleException(Throwable cause) {
super("The server is currently not accessible.", cause);
}
}
public class UnauthorizedUserException extends Exception {
public UnauthorizedUserException() {
super("The user is not authorized.");
}
public UnauthorizedUserException(Throwable cause) {
super("The user is not authorized.", cause);
}
}
public class BannedUserException extends Exception {
public BannedUserException() {
super("The user is banned.");
}
public BannedUserException(Throwable cause) {
super("The user is banned.", cause);
}
}
public class RestrictionException extends Exception {
public RestrictionException() {
super("Access is denied.");
}
public RestrictionException(Throwable cause) {
super("Access is denied.", cause);
}
}
public static void main(String[] args) {
}
}