14 lines
348 B
Java
14 lines
348 B
Java
//: operators/Precedence.java
|
|
// ©2015 MindView LLC: see Copyright.txt
|
|
|
|
public class Precedence {
|
|
public static void main(String[] args) {
|
|
int x = 1, y = 2, z = 3;
|
|
int a = x + y - 2/2 + z; // (1)
|
|
int b = x + (y - 2)/(2 + z); // (2)
|
|
System.out.println("a = " + a + " b = " + b);
|
|
}
|
|
} /* Output:
|
|
a = 5 b = 1
|
|
*///:~
|