Tuesday 17 January 2017

What is Operator overloading ?

Operator overloading basically means to use the same operator for different data types. And get different but similar behavior because of this.
Java indeed doesn't support this but any situation where something like this could be useful, you can easily work around it in Java.

The only overloaded operator in Java is the arithmetic + operator. When used with numbers (int, long, double etc.), it adds them, just as you would expect. When used with String objects, it concatenates them.

1 comment: