Skip to content

Commit b419854

Browse files
author
StephLew1
committed
Completed Comparing Values
1 parent 1ee2613 commit b419854

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

‎ch05/Precedence.java‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
public class Precedence
2+
3+
{
4+
public static void main(String[] args )
5+
{
6+
int sum = 32 - 8 + 16 * 2 ; // 16 x 2 = 32, + 24 + 56
7+
System.out.println( "Default order: " + sum ) ;
8+
sum = ( 32 - 8 + 16 ) * 2 ; // 24 + 16 = 40, x 2 + 80
9+
System.out.println( "Specified order: " + sum ) ;
10+
sum = ( 32 - (8 + 16) ) * 2 ; // 32 - 24 + 8, * 2 = 80
11+
System.out.println( "Nested specific order: " + sum ) ;
12+
13+
14+
15+
}
16+
17+
18+
}

0 commit comments

Comments
 (0)