I am new to java
int nop=o;
BufferedReader scan = new BufferedReader( new InputStreamReader(System.in));
come_here:
System.out.println("Enter length");
try{
int n=Integer.parseInt(scan.readLine());
nop=n;
}catch(Exception sandy){
System.out.println("Please Enter Numericals only");
continue come_here;
}
If user entered any string instead of numericals Exceptions occurs and prints "Please Enter Numericals only" and compiler executes next statements, here am loosing user input to overcome that I have used label (come here:
), if an Exception occurs it says "Please Enter Numericals only" after that I want program to take user input again, I used continue come_here;
but its not working?
any anybody tell where I have done mistake? and how to resolve that
thank you