Results 1 to 2 of 2
Thread: Help with "if" statements
- 10-22-2012, 02:55 PM #1
Member
- Join Date
- Oct 2012
- Posts
- 2
- Rep Power
- 0
Help with "if" statements
Hi guys,
I'm trying to write an if statement with two conditions, then print some text as a result.
I'm asking the user for a date, between 1 and 31 - and im trying to say "if (variable <1 OR >31)"...what do I need to enter here in place of "or"?
Obviously, I'm brand new to this - so ANY help would be appreciated :)
Thanks
- 10-22-2012, 03:12 PM #2
Re: Help with "if" statements
You have to use complete boolean expressions. You can't do this:
if(something < 10 || > 20){...
Instead, you have to do this:
if(something < 10 || something > 20){...
This is covered in the basic tutorials here: Equality, Relational, and Conditional Operators (The Java™ Tutorials > Learning the Java Language > Language Basics)How to Ask Questions the Smart Way
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
Similar Threads
-
loop "play again" in an 8 ball game , loops but wont let me answer my "out.print"
By IareSmart in forum New To JavaReplies: 1Last Post: 02-01-2012, 08:37 PM -
Trouble with "if-else" statements please help URGENT!
By n00624657 in forum EclipseReplies: 4Last Post: 10-12-2011, 07:17 AM -
I cant figure out my "if "else" statements any help?
By prendergast36 in forum New To JavaReplies: 9Last Post: 09-17-2011, 12:36 AM -
MoneyOut.println("It took you (whats wrong?>",year,"<WW?) years to repay the loan")
By soc86 in forum New To JavaReplies: 2Last Post: 01-24-2009, 06:56 PM -
the dollar sign "$", prints like any other normal char in java like "a" or "*" ?
By lse123 in forum New To JavaReplies: 1Last Post: 10-20-2008, 07:35 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks