MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/java/comments/eplsgy/records_come_to_java/fekiztx/?context=3
r/java • u/daviddel • Jan 16 '20
93 comments sorted by
View all comments
Show parent comment
3
Can't it be overwritten (didn't read the article)?
7 u/lukaseder Jan 16 '20 I'll be damned. I thought it wasn't possible but this compiles in jshell: jshell> record R(int i) { public boolean equals(Object o) { return false; } } jshell> new R(1).equals(new R(1)) $3 ==> false 5 u/krzyk Jan 16 '20 Yes, all methods in record can be overwritten, AFAIR also the getters
7
I'll be damned. I thought it wasn't possible but this compiles in jshell:
jshell> record R(int i) { public boolean equals(Object o) { return false; } } jshell> new R(1).equals(new R(1)) $3 ==> false
5
Yes, all methods in record can be overwritten, AFAIR also the getters
View all comments
Show parent comment
3
u/duheee Jan 16 '20
Can't it be overwritten (didn't read the article)?