Showing posts with label Topic 02. Show all posts
Showing posts with label Topic 02. Show all posts

Tuesday, October 03, 2006

Operator Precedence Example



public class OperatorPrecedenceExample {
public static void main(String[] args) {
int a = 5, b = 6, c=10, d=2;
double result;
result = a+d*c%++b;
/*
= a+((d*c)%(b+1))
= 5 +((20)% (7))
= 5+6 = 11
*/

System.out.println(result);
} //end main
} //end class