Skip to content

Instantly share code, notes, and snippets.

@techtangents
Last active December 14, 2015 18:58
Show Gist options
  • Save techtangents/5132671 to your computer and use it in GitHub Desktop.
Save techtangents/5132671 to your computer and use it in GitHub Desktop.
Absolutely:
- any integer
- Incorrect - any integer except Integer.MIN_VALUE
Bytes:
- on each line, the numbers [0..128], [-127..-1]
- Incorrect - infinite loop
Constants:
- characters on lines: STUVWXYZ
- Incorrect: STUWYZ
- classes V and X doesn't statically initialize, as the constant is inlined
EggsToast:
- x = null
- Incorrect: x = 0
- I would have been right if the reference was "Integer"
Hello
- hello
- Incorrect: icecream\nhello
- That one fools the intellij and github syntax highlighers (and me)
Maps
- true, true, true, true
- Incorrect: true, false, false, false
- this will compare boxed values and lower values will be interned?
MutableString
- no
- Correct!
NegEquals
- 0
- Correct!
- -0 == 0
Nullify
- null!
- Correct!
- static reference doesn't need a valid object
PrivateCtorOverride
- m, m
- Incorrect: main, m
- In the first case, printS is not inherited, so the outer object's printS is called
- In the second case, printS is inherited, so the inner object's printS is called
StringReference
- true
- Incorrect: false
- I thought it would intern for some reason.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment