+ 2

Can you use: if(0<x<16)?

Do you have to create multilple statements to say "if x is greater than 0 and less than 16?"

8th Aug 2016, 4:54 PM
Zach
10 Answers
+ 18
if (0 < x && x < 16)....is a better way
8th Aug 2016, 4:58 PM
FreakManMega
+ 3
Did you try it? error: bad operand types for binary operator '<' System.out.println (a<x<c) ^ first type: boolean second type: Integer 1 error Using numbers instead of variables just changes the second type to 'int'.
10th Jan 2017, 12:58 PM
Kirk Schafer
Kirk Schafer - avatar
+ 2
use logical operator &&
31st Aug 2016, 2:05 AM
Shashwat Pal
Shashwat Pal - avatar
+ 1
can we use (x>0 && ×<16)
7th Dec 2016, 1:21 PM
Bitz Uzi
Bitz Uzi - avatar
+ 1
You must use the logical operator && (and) to evaluate 0<x and x<16
17th Dec 2016, 2:00 PM
Eliecer Cedano
Eliecer Cedano - avatar
0
why not?? what is wrong with the statement? it's the same as if(0<x&&x<16)
14th Dec 2016, 3:42 PM
Sasa Potic
Sasa Potic - avatar
- 2
you can define such conditions in nested if.
14th Aug 2016, 9:08 AM
Gowtham krvz kv
Gowtham krvz kv - avatar
- 3
No we cannot use this statement
8th Aug 2016, 5:15 PM
Smriti
- 3
noo
17th Aug 2016, 6:59 AM
pavan kalyan
- 3
no
2nd Sep 2016, 6:05 PM
Anas Knbar
Anas Knbar - avatar