W
William
Hi,
I'm having difficulty reading a boolean value from the console using:
oPlayer.setMember(Input.readBoolean(new String ("Is this Person a Club
Member? : "))) ;
public static boolean readBoolean(String sPrompt) throws IOException
{
boolean bMember = false ;
if (sPrompt != null) System.out.print(sPrompt) ;
try
{
bMember = new Boolean(new
StringTokenizer(keyBoard.readLine()).nextToken()).booleanValue() ;
return bMember ;
}
catch (IOException e)
{ /* Mmmm damn it! */ }
finally
{ return bMember ; }
But regardless of what I enter (Y,y,N,n,T,t,F,f) I always end up with a
false value for the oPlayer.m_bMember attribute. I'd appreciate it if
someone could point out to me what I (must) be doing wrong.
I'm having difficulty reading a boolean value from the console using:
oPlayer.setMember(Input.readBoolean(new String ("Is this Person a Club
Member? : "))) ;
public static boolean readBoolean(String sPrompt) throws IOException
{
boolean bMember = false ;
if (sPrompt != null) System.out.print(sPrompt) ;
try
{
bMember = new Boolean(new
StringTokenizer(keyBoard.readLine()).nextToken()).booleanValue() ;
return bMember ;
}
catch (IOException e)
{ /* Mmmm damn it! */ }
finally
{ return bMember ; }
But regardless of what I enter (Y,y,N,n,T,t,F,f) I always end up with a
false value for the oPlayer.m_bMember attribute. I'd appreciate it if
someone could point out to me what I (must) be doing wrong.