Pradius
  • Pradius
Java Programming.. If I want to use the If statement to say : If (x > 4 and <9){} What operator should I use? or what method?
Computer Science
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
schrodinger
  • schrodinger
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
anonymous
  • anonymous
and is "&&"
anonymous
  • anonymous
so it would be If(x>4 && X<9){}
Pradius
  • Pradius
yeah but that operator is not working...

Looking for something else?

Not the answer you are looking for? Search for more explanations.

More answers

anonymous
  • anonymous
&& is the logical "and" operator to compare two boolean values, should be working
Pradius
  • Pradius
u try it..
anonymous
  • anonymous
try putting it in parentheses so if ((x>4)&&(x<9))
anonymous
  • anonymous
if(( x > 4) && (X < 9 )) { //Do something here. } Hey! That's exactly I was going to post lol
Pradius
  • Pradius
There you go , That's exactly what I was looking for.. I was trying something like that but without some parenthesis If (x >4)&(<9) but I forgot that theres only one condition so everything must be within a set of parenthesis. Thanks man!
rsmith6559
  • rsmith6559
Just so you know, the single ampersand is a legal operator. It's used for bitwise and.
anonymous
  • anonymous
if(x>4 && x<9 ) { // your stuff }
anonymous
  • anonymous
There's also the assignment conditional operator used for singular assignments. a = (b > c) ? b : c; So if b is greater than c, a takes the value of b, otherwise it takes the value of c. More formally, this is read as: value = (condition) ? (true value) : (false value); The condition can be any valid conditional statement, as long as it validates before the ? operator.

Looking for something else?

Not the answer you are looking for? Search for more explanations.