Operator overloading in Java

前端 未结 10 1749
独厮守ぢ
独厮守ぢ 2020-11-21 23:51

Please can you tell me if it is possible to overload operators in Java? If it is used anywhere in Java could you please tell me about it.

10条回答
  •  说谎
    说谎 (楼主)
    2020-11-22 00:25

    Operator overloading is used in Java for the concatenation of the String type:

    String concat = "one" + "two";
    

    However, you cannot define your own operator overloads.

提交回复
热议问题