Exception message is not showing
import java.util.*;
class WrongException extends Exception{
public WrongException(String s){
super(s);
}
}
public class UserDefinedException2{
public static void main(String s[]){
int a,b;
a=b=0;
Scanner ob=new Scanner(System.in);
System.out.print("Enter your age = ");
a=ob.nextInt();
try
{
if(a<=0)
throw new WrongException("age cannot be zero or nagetive");
System.out.print("age = "+a);
}
catch(WrongException e){
System.out.print("wrong");
}
}
}
throw new WrongException("age cannot be zero or nagetive")
this message is not showing why??
and this message is showing System.out.print("wrong")
please help me