Write a program WrongInputException using java-Technology369kk

Program:

class WrongInputException extends Exception{
WrongInputException(String s){
super(s);
}
}
class Input{
void method() throws WrongInputException{
throw new WrongInputException("Wrong Input ");
}
}
class TestInput{
public static void main(String[] args){
try{
new Input().method();
}
catch(WrongInputException wie){
System.out.println(wie.getMessage());
}
}
}




 

Answer: 


Wrong Input
 

 

Post a Comment

0 Comments