I did this several times and came up with the same result. What is wrong with my code and how do I fix it?
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” (Mosher's Law of Software Engineering)
“If debugging is the process of removing bugs, then programming must be the process of putting them in.” (Edsger Dijkstra)
Also, it's bad form to use == to compare booleans to true or false.
And the topic has nothing to do with GUIs, so I shall move it to an appropriate place.
luck, db
There are no new questions, but there may be new answers.
Or get in the habit of using Yoda Conditions if(false=started) will give the error you expect
if(false==started) will then work as desired
see alse
if("".equals(mystring)) and other constant==variable forms.
One tip on posting questions...When you simply say "My code doesn't work", it can be extremely hard for folks to know what you mean. Please tell what is is doing (you did that) and what you think it should be doing (that's the part you didn't).
A lot of the time, the code IS working the way it should, but the original poster's idea of how it should work is wrong - and that can't be corrected unless we know what that is.
Never ascribe to malice that which can be adequately explained by stupidity.
David O'Meara wrote: . . .
if(false=started) will give the error you expect
if(false==started) will then work as desired
see also
if("".equals(mystring)) and other constant==variable forms.
I personally would ban the use of == or != with true or false as an operand, on either side. But if ("Campbell".equals(name)) is a good idea; you cannot get a NullPointerException from it, however hard you try.