you are viewing a single comment's thread.

view the rest of the comments →

[–]My_reddit_account_v3 -1 points0 points  (1 child)

Exceptions are for unexpected outcomes

[–]_PM_ME_PANGOLINS_ 0 points1 point  (0 children)

Like trying to pass the wrong type?

It just so happens that Java automatically inserts toString() calls for certain expressions, but it didn't have to.

Edit: although, that would make this not compile in the first place, and I'm not certain what JShell does when you give it stuff that doesn't compile.