Hello, would someone mind showing me what I'm doing wrong with my code?
The code won't compile unless I initialize the boolean rain variable to either true or false. I use a S.O.P statement to check the value of rain after the conditional/assignment of rain and no matter what is entered for weather rain always keeps the value of that it was initialized with.
Thank you so much for your help. I've had a little bit of "fuzzy" logic on this one and you've certainly got me in the right dircection. Your last reply was exactly what I needed to do to make this program work.
One day (maybe several hundred-thousand from now after I learn Java ) I hope to be able to contribute to the boards here like you have. You're most helpful. Thanks again
All local variables, not just boolean types, need to be initialized before use.
Here's another tip:
Instead of waiting until you're a Java expert to contribute to JavaRanch, you can use JavaRanch to learn interactively. How? When someone posts a question, research the answer. Then, if you can explain the answer clearly, you have not only helped the original poster, you have also helped yourself because you now have one more piece of Java knowledge that you didn't have before. I know of few learning methods more effective than teaching.
Give a man a fish, he'll eat for one day. Teach a man to fish, he'll drink all your beer.
Cheers, Jeff (SCJP 1.4, SCJD in progress, if you can call that progress...)
Joined: Oct 20, 2004
Good Point! Also, thanks for your information about local variables.