Does Java support operator overloading?

  • No, not at all.
  • Only for arithmetic ops.
  • Yes, for all operators.
  • Yes, for selected ops.
Java does not support operator overloading for custom classes. While some languages do allow operator overloading, Java enforces a fixed set of operators for built-in types, and you cannot create custom operator overloads. This limitation helps maintain code readability and prevents ambiguity.
Add your answer
Loading...

Leave a comment

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