I am taking input from user and it should be string only, but code is not working as I expected. Here is my code `
while(true){
try{
System.out.print("Enter test string");
str=sc.nextLine();
break;
}
catch(InputMismatchException e) {
System.out.println("Please enter String value");
continue;
}
}
System.out.println(str);
`
If I am giving integer value than it should ask again but here it is printing integer value.Also no Special character