class Test
{
private static boolean b
(String label,
boolean value
) { System.
out.
println(label
+ ": " + value
); return value;
}
public static void main
(String[] args
) {
if (b("1", true) || (b("2", false) || b("3", true)) && b("4", false))
{
System.
out.
println("How does this condition becomes true."); }
if (b("5", false) && (b("6", false) || b("7", true)) || b("8", true))
{
System.
out.
println("Same with this condition, why is it true."); }
}
}
Y2xhc3MgVGVzdAp7CiAgICBwcml2YXRlIHN0YXRpYyBib29sZWFuIGIoU3RyaW5nIGxhYmVsLCBib29sZWFuIHZhbHVlKSB7CiAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKGxhYmVsICsgIjogIiArIHZhbHVlKTsKICAgICAgICByZXR1cm4gdmFsdWU7CiAgICB9CiAgICBwdWJsaWMgc3RhdGljIHZvaWQgbWFpbihTdHJpbmdbXSBhcmdzKQogICAgewogICAgICAgIGlmIChiKCIxIiwgdHJ1ZSkgfHwgKGIoIjIiLCBmYWxzZSkgfHwgYigiMyIsIHRydWUpKSAmJiBiKCI0IiwgZmFsc2UpKQogICAgICAgIHsKICAgICAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKCJIb3cgZG9lcyB0aGlzIGNvbmRpdGlvbiBiZWNvbWVzIHRydWUuIik7CiAgICAgICAgfQoKICAgICAgICBpZiAoYigiNSIsIGZhbHNlKSAmJiAoYigiNiIsIGZhbHNlKSB8fCBiKCI3IiwgdHJ1ZSkpIHx8IGIoIjgiLCB0cnVlKSkKICAgICAgICB7CiAgICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbigiU2FtZSB3aXRoIHRoaXMgY29uZGl0aW9uLCB3aHkgaXMgaXQgdHJ1ZS4iKTsKICAgICAgICB9CiAgICB9Cn0K