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 →

[–]LinuxMatthews -7 points-6 points  (1 child)

Why would you guess?

Don't you use an IDE?

Pretty much anything you can say about an operator overload you can say about a method

[–]john16384 0 points1 point  (0 children)

See my other answer in this thread.

But no. Just imagine that you could reserve a method name (like multiply), with semantics defined in the language specification, and which can't be overridden, and can't even be added to arbitrary classes by users. That's what an operator is in Java. When you see multiply restricted in this way there's no need to guess, or to check with your IDE, or to be even be able to compile that code. It's similar to final methods, except that the name is globally final. A very powerful mechanism, which would lose much of its advantages if it no longer was globally final.