Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b7N4ZDbUtA3ofqAqRV
15 lines
412 B
Plaintext
15 lines
412 B
Plaintext
$ java --enable-preview src/ValueClassDemo.java
|
|
value record a == b : true
|
|
ordinary record a == b: false
|
|
Money has identity : false
|
|
Integer 1996 == 1996 : true
|
|
IdentityException: Cannot synchronize on an instance of value class java.lang.Integer
|
|
|
|
$ java src/IntegerEquality.java
|
|
x == y : false
|
|
x.equals(y) : true
|
|
|
|
$ java --enable-preview src/IntegerEquality.java
|
|
x == y : true
|
|
x.equals(y) : true
|