+ 1

What is the answer of this expression Is this can be together && and || ?

int x =19, z= -6, y = 19: (x == z) || (z <x } && (y < 8 * 4):

17th Jan 2022, 6:52 PM
Loo Student
5 Respuestas
+ 3
Your code doesn't have anything to do with regular expressions. I think "Java" would fit better. Again: 👉 Check the spelling and the brackets/ parentheses
17th Jan 2022, 6:58 PM
Lisa
Lisa - avatar
+ 2
Please tag the relevant programming language. The code will give error. Please check the spelling and the brackets
17th Jan 2022, 6:55 PM
Lisa
Lisa - avatar
+ 1
&& and || together are OK, but there are some syntactical mistakes. result depends how you assign y edit: now y=19 so result is true
17th Jan 2022, 9:54 PM
zemiak
+ 1
These are logical operators and they can be together in same expression. First we do operations in brackets: 19=-6 is false, then -6 < 19 true, then 19 < 8*4 true. Now expression looks like false || true && true which converts into false || true. The result is true. You can read about Java logical operators precedence to understand why.
18th Jan 2022, 10:15 PM
Vlad Valov
Vlad Valov - avatar
0
Java
17th Jan 2022, 6:56 PM
Loo Student