Hi all,
I am missing something in the IO reading stakes. The following method runs but doesn't exit after I have entered a keyboard number.
What am I fundamentally doing wrong?
Any help appreciated.
Stan.
public int createLoc() throws IOException
{
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader stdin = new BufferedReader(isr);
try
{
System.out.print("Enter type : 1=home, 2=office, 3=car: ");
type = Integer.parseInt(stdin.readLine());
}
catch(IOException ioe)
{
System.out.println("no good");
}
stdin.close();
System.out.println(type+" was entered");
return type;
}
I am missing something in the IO reading stakes. The following method runs but doesn't exit after I have entered a keyboard number.
What am I fundamentally doing wrong?
Any help appreciated.
Stan.
public int createLoc() throws IOException
{
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader stdin = new BufferedReader(isr);
try
{
System.out.print("Enter type : 1=home, 2=office, 3=car: ");
type = Integer.parseInt(stdin.readLine());
}
catch(IOException ioe)
{
System.out.println("no good");
}
stdin.close();
System.out.println(type+" was entered");
return type;
}