You are viewing a single comment's thread. Return to all comments →
Great solutions! I like the second in particular, it seems to me like it is the most readable one.
For anyone who struggled to get this problem right, I recommend taking an introductory Java course, focusing on the basics. You can a couple of these courses here: https://classpert.com/java-programming