Problem Statement
Explain operator overloading in Kotlin and how it differs from Java.
Explanation
Kotlin supports operator overloading allowing you to define how operators like plus, minus, times work with your custom types by defining functions with specific names like operator fun plus, making code more intuitive and readable. Unlike Java which doesn't support operator overloading, Kotlin lets you write expressions like point1 plus point2 instead of point1 dot add point2, but this must be done responsibly to maintain code clarity. Standard operators have corresponding function names like plus for plus, minus for minus, times for asterisk, div for slash, rem for percent, and you mark these functions with operator keyword. You can overload comparison operators equals, compareTo, index access operators get set for square brackets, invoke operator for calling objects as functions, and even in operator for contains checks. Kotlin also supports operator overloading for extension functions letting you add operator support to existing classes, but use this feature judiciously as overloading operators poorly can make code confusing rather than clearer.