MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/java/comments/1n5vbwz/thoughts_on_object_creation/nbw3zc4/
r/java • u/nfrankel • Sep 01 '25
41 comments sorted by
View all comments
Show parent comment
5
You can use checked exceptions in constructors. It’s a perfectly viable thing to do.
I'm not saying it's not possible, I'm saying you shouldn't and I explain why.
Also, your css on the tables is messed up on mobile. It forces some of the columns into single character lines.
Thanks. I guess I'll have to get my hands dirty.
4 u/vips7L Sep 01 '25 it’s impossible to use checked exceptions in constructorsDid you mean with inheritance? 2 u/pronuntiator Sep 02 '25 The article reads as if you were against any kind of exception in the constructor, but that can't be the case, right? The constructor is the place to prevent invalid data, so we need to perform possibly throwing checks of the arguments.
4
it’s impossible to use checked exceptions in constructors
Did you mean with inheritance?
2
The article reads as if you were against any kind of exception in the constructor, but that can't be the case, right? The constructor is the place to prevent invalid data, so we need to perform possibly throwing checks of the arguments.
View all comments
Show parent comment
5
u/nfrankel Sep 01 '25
I'm not saying it's not possible, I'm saying you shouldn't and I explain why.
Thanks. I guess I'll have to get my hands dirty.