How is operator overloading achieved for the String class in Java?

  • By defining custom methods for concatenation
  • By using the '+' operator for String concatenation
  • By using the '+' operator with custom type conversion
  • Java does not support operator overloading for the String class
Operator overloading is not supported for the String class in Java. Instead, Java provides a convenient way to concatenate strings using the '+' operator, but it doesn't involve operator overloading. You can use custom methods for string manipulation, but it's not true operator overloading.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *