How do I Implement Operators in a Java Class

后端 未结 7 1823
南旧
南旧 2020-12-07 01:30

I am attempting to create a unsigned integer class.

public class UnsignedInteger extends Number implements Comparable 
    { 
    ...          


        
7条回答
  •  隐瞒了意图╮
    2020-12-07 02:19

    It's not possible to override operators in Java. What you can do is define methods to represent the operations, like BigDecimal or BigInteger in the standard library do.

提交回复
热议问题