Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var x = null;
- var y = 0;
- System.println("x = null");
- System.println("y = 0");
- System.println("");
- System.println("Trying if (x)...");
- if (x)
- {
- // do nothing
- }
- else
- {
- System.println(" if (x) works");
- }
- System.println("Trying if (y)...");
- if (y)
- {
- // do nothing
- }
- else
- {
- System.println(" if (y) works");
- }
- System.println("Trying if (x && y)...");
- if (x && y) // this is fine
- {
- // do nothing
- }
- else
- {
- System.println(" if (x && y) works");
- }
- System.println("Trying if (x || y)...");
- if (x || y) // this will crash, probably because logical "||" is misimplemented as bitwise "|"
- {
- // do nothing
- }
- else
- {
- System.println("if (x || y) works");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement