要求声明定义两个Exception的异常子类
要求声明定义两个Exception的异常子类:NoLowerLetter类和NoDigit类。再声明一个People类,该类中的voidprintLetter(charc...
要求声明定义两个Exception的异常子类:NoLowerLetter类和NoDigit类。再声明一个People类,该类中的void printLetter(char c)方法抛出NoLowerLetter异常类对象,void PrintDigit(char c)方法抛出NoDigit异常类对象。java
展开
展开全部
public class NoLowerLetter extends Exception {
public NoLowerLetter () {
super();
}
}
public class NoDigit extends Exception {
public NoDigit () {
super();
}
}
public class People{
void printLetter(char c){
throw new NoLowerLetter("抛出NoLowerLetter异常");
}
void PrintDigit(char c){
throw new NoDigit("抛出NoDigit异常");
}
}
public NoLowerLetter () {
super();
}
}
public class NoDigit extends Exception {
public NoDigit () {
super();
}
}
public class People{
void printLetter(char c){
throw new NoLowerLetter("抛出NoLowerLetter异常");
}
void PrintDigit(char c){
throw new NoDigit("抛出NoDigit异常");
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询