2 ms·
Java: * Reassigning interned integers via reflection * private fields work on a class level, not an instance level, i.e. Instances of a class can read private
by Macha 11y ago
Java:
* Reassigning interned integers via reflection
* private fields work on a class level, not an instance level, i.e. Instances of a class can read private fields of other instances of the same class.
* Arguably package-private fields as the docs like to avoid mentioning they exist.
* ==, particularly in regards to boxed types.
* List<String> x = new ArrayList<String>() {{
add("hello");
add("world");
}};
* The behaviour of .equals with the object you create above
* Type Erasure
- dlwh 11y agoto add another: System.out.println(0.0 == -0.0); // true System.out.println(java.util.Arrays.equals(new double[] {0.0}, new double[] {-0.0})); // false (It's documented in the contract for Arrays.equals, but still kind of ridiculous.)
- tomsthumb 11y agoByte is signed. `Byte b = 127; b += 1; assert b != 128;`. That's not cool man.