Multiple conditions in Java

142 Views Asked by At

Is there any way to test for multiple conditions in Java in a short way?

Let's use the following example:

if(height == 1 && width == 3 && visible && running && users<3)
doThis();

This is a rather short test, but what if there's more? I'm aware of that nested if(test) can help with the structure, but also this becomes hard to follow after some 10 tests. Imagine also the test varies in the code, so no standardised method can be called. Is the stated way the only decent possibility?

0

There are 0 best solutions below