Skip to content

Instantly share code, notes, and snippets.

@benjholla
Created October 8, 2018 16:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benjholla/5d5ba6ee8a756397193ebe1ca5d51ae2 to your computer and use it in GitHub Desktop.
Save benjholla/5d5ba6ee8a756397193ebe1ca5d51ae2 to your computer and use it in GitHub Desktop.
Java Puzzle 14 (spot the bug if one exists)
public class Puzzle14 {
public static void main(String[] args) {
char x = 'X';
int i = 0;
System.out.print(true ? x : 0);
System.out.print(false ? i : x);
}
}
@benjholla
Copy link
Author

Adapted from Java Puzzlers: Traps, Pitfalls, and Corner Cases - Puzzle #8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment