2015-02-25 16:00:53 +01:00
|
|
|
// << have higher precedence than |.
|
2015-09-15 07:46:09 -07:00
|
|
|
System.print(2 | 1 << 1) // expect: 2
|
|
|
|
|
System.print(1 << 1 | 2) // expect: 2
|
2015-02-25 16:00:53 +01:00
|
|
|
|
|
|
|
|
// << has higher precedence than &.
|
2015-09-15 07:46:09 -07:00
|
|
|
System.print(2 & 1 << 1) // expect: 2
|
|
|
|
|
System.print(1 << 1 & 2) // expect: 2
|
2015-02-25 16:00:53 +01:00
|
|
|
|
|
|
|
|
// << has higher precedence than ^.
|
2015-09-15 07:46:09 -07:00
|
|
|
System.print(2 ^ 1 << 1) // expect: 0
|
|
|
|
|
System.print(1 << 1 ^ 2) // expect: 0
|
2015-02-23 17:29:31 +01:00
|
|
|
|
2015-02-25 16:00:53 +01:00
|
|
|
// & has higher precedence than |.
|
2015-09-15 07:46:09 -07:00
|
|
|
System.print(1 & 1 | 2) // expect: 3
|
|
|
|
|
System.print(2 | 1 & 1) // expect: 3
|
2015-02-25 16:00:53 +01:00
|
|
|
|
|
|
|
|
// & has higher precedence than ^.
|
2015-09-15 07:46:09 -07:00
|
|
|
System.print(1 & 1 ^ 2) // expect: 3
|
|
|
|
|
System.print(2 ^ 1 & 1) // expect: 3
|
2015-02-25 16:00:53 +01:00
|
|
|
|
|
|
|
|
// ^ has higher precedence than |.
|
2015-09-15 07:46:09 -07:00
|
|
|
System.print(1 ^ 1 | 1) // expect: 1
|
|
|
|
|
System.print(1 | 1 ^ 1) // expect: 1
|