I'm confused, this field should have different value in every class so should I create interface with this field or write it manually in every class?
Asked
Active
Viewed 68 times
0
-
2In every class. Here's some link: [What is a serialVersionUID and why should I use it?](https://stackoverflow.com/questions/285793/what-is-a-serialversionuid-and-why-should-i-use-it) and [What is a serial version UID used for?](https://stackoverflow.com/questions/21562525/what-is-a-serial-version-uid-used-for) – RubenDG Nov 14 '18 at 17:57
-
1Even if you define an interface, you would ideally want to assign a unique value in each instance, so you might as well just declare it everywhere anyway. – Kevin Welker Nov 14 '18 at 18:00
-
@RubenDG thx for helping! – Armin Nov 14 '18 at 18:44
-
@KevinWelker i guess it has smth with "Serializable". Thx for replying anyway ! – Armin Nov 14 '18 at 18:54
-
You should first ask yourself if those classes should be Serializable at all (they probably shouldn't), and then if the automatically generated value is good enough for your purpose. – Mark Rotteveel Nov 15 '18 at 10:06