So everywhere I look, it says that && is evaluated first, then || is evaluated second. So either I am doing something wrong or it is wrong. Here's the code:
static boolean foo(boolean b, int id){ System.out.println(id); return b;}
static{ System.out.println(foo(true, 3) && foo(true, 1) || foo(false, 2)) }
//returns 3 1
static{ System.out.println(foo(true, 2) || foo(true, 3) && foo(true, 1)}
//returns 2
In the first static block, && goes first, short circuits and ignores the || but in the second static block which is simply the reverse, || goes first and ignored the &&. This demonstrates left to right but according to the java doc, && has higher precedence which means && should always go first.
Some documents about precedence (logical and is higher than or):
1. https://docs.oracle.com/javase/tutorial/java/nutsandbolts/operators.html
2. https://chortle.ccsu.edu/Java5/Notes/chap40/ch40_16.html
3. http://www.cs.bilkent.edu.tr/~guvenir/courses/CS101/op_precedence.html
...