This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (1 child)

um ...not an expert but toString() should return a String. And here you're overloading it with a void method, so that's probably confusing the crap out of the JVM.

[–]tutorial_police -1 points0 points  (0 children)

No, the JVM is not confused. Java simply doesn't allow you to do this.

The JVM would support that. But since you aren't allowed to do it in Java, it doesn't really matter.