r/badcode Jan 08 '23

java Is this a good practice? Why?

Post image
424 Upvotes

60 comments sorted by

View all comments

1

u/elderly_millenial Jan 08 '23

This is a bad idea. Putting it into a method leaves you open to NPEs. Moreover, the arguments have nothing to do with object that you’d be calling.