November 28, 2007

Solution:Java Puzzle-1

The output of the puzzle snippet will be:

stmt2
stmt2
stmt1

Because in statement if(method()¦ method()), only pipe ¦ has been mentioned. One ¦ represents 'Bitwise OR' and bitwise OR evaluates both sides of its parameter . This way it executes method() twice and then prints stmt1.

No comments:

Post a Comment