Forum Home
Press F1
 
Thread ID: 6703 2000-12-03 02:51:00 JAVA, HELP with if statement Guest (0) Press F1
Post ID Timestamp Content User
7357 2000-12-03 02:51:00 I am trying to ask a question from the user, I am assigning the value of the answer to a variable. But when I try to use the variable in an if statement I am getting, cannot convert boolean to string.

eg.

'would you like an apple, y/n?'

if ( apple = Y )
system.out.print ' fantastic'

else system.out.print ' Would you like an orange y/n?'

etc etc

How can I ask the user for a Y/N or a true or false? and manipulate it in an IF.

Please post sample code.

Thanks
Guest (0)
1