Click here to Skip to main content
15,891,409 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
How to have 3 conditions in if statement?

What I have tried:

I tried writing && two times but didn't worked.
Posted
Updated 20-Jul-21 1:37am
Comments
Richard MacCutchan 20-Jul-21 7:31am    
if (X && Y && Z)
if (X || Y || Z)

etc.

Go and read the documentation: it is all there, neatly laid out and clearly explained, especially for new programmers who are trying to learn. But maybe you are not trying to learn.

Oh come on! Are you actually trying to not learn anything? Because your question history would definitely support that theory!

Java
if ( a > b && c > d && e > f) {
   ...
 
Share this answer
 
v2
Quote:
I tried writing && two times but didn't worked.

Reread your question, you have been very careful to give no information on your problem.
Since the usage heavily depend on how you want to combine conditions, it gets difficult to tell without source code.
You forgot to show the code for condition and you forgot to tell how the 3 conditions are supposed to work together. && is only 1 of the operators to combine conditions.

For more information you need to read the documentation and/or follow some tutorial.
Java Tutorial[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900