about com.enthuware.ets.scjp.v6.2.391
Posted: Sat Sep 06, 2014 8:10 am
Hello,
I did not understand. Based on http://docs.oracle.com/javase/tutorial/ ... ators.html (operator precendence) && comes before || so should evaluate first right side "(b = true) && (c = true)" and print "true, true, true" or perhaps "false true true".
Where is my mistake?
thank you
Code: Select all
class Test
{
static boolean a;
static boolean b;
static boolean c;
public static void main (String[] args)
{
boolean bool = (a = true) || (b = true) && (c = true);
System.out.print(a + ", " + b + ", " + c);//it will print "true, false, false"
}
}
Where is my mistake?
thank you