if(play == null)
{
// The user has asked to quit
// >>>> add program quitting logic here<<<<
}
else
{
x = Integer.parseInt(play)
}
Type: Posts; User: Norm
if(play == null)
{
// The user has asked to quit
// >>>> add program quitting logic here<<<<
}
else
{
x = Integer.parseInt(play)
}
Yes the code would be like that so it would not call the parseInt() method with a null value.
The (play!=null) test is redundant. The (play==null) test in the if guarantees that play will not be...
What is the "it" you are asking about?
The value of the variable passed to the parseInt() method on line 48 was null. The code should test the variable's value before passing it the the parseInt() method. The code in post#9 is wrong. ...
Use the println() method to print out the value of the variable that was assigned what was returned by the method (play in the above code).
Please explain what happened.
Is null what is returned to the play variable when the user clicks cancel?
Then the code you posted would detect that:
play = JOP.sIP("dialog")
if(play == null)
{
// The user has asked to...
How do you know if the user has quit? What does the user enter that says "I quit"?
Can the program then test for that input from the user and do what you want done?
There are two issues:...
Can you post the line of code that is giving the error message?
Also say what data types all the variables in that line are.
boolean variables can have the values: true or false
Several choices: set a boolean variable and exit the loop the code is in. Outer loops need to check the boolean to see if the code is to exit.
Call the System.exit(0) method to end the program's...
The problem with using ORs to connect expressions in a large condition is that if any one is true the condition is true.
If you want all of the subexpressions to be true, use ANDs