Hi When I run the following code I am getting NumberFormatException
can anybody help me out in debugging code.
import java.io.*;
public class Case1 {
public static void main(String args[])
{
char ch='y';int i=0;
BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
System.out.println("ch before while:::"+ch);
while(ch=='y'||ch=='Y'){
try{
System.out.println("Enter the option");
i=Integer.parseInt(bf.readLine());
System.out.println("after"+i);
switch {
case 1 ystem.out.println("1"); break;
case 2 ystem.out.println("1"); break;
}
System.out.println("do u want to continue(Y/y");
ch=(char)bf.read();
System.out.println("ch after execution:::"+ch);
}
catch(NumberFormatException e){e.printStackTrace();}
catch(IOException e){e.printStackTrace();}
}
}}