Is autoboxing possible for the classes I create?

前端 未结 4 805
生来不讨喜
生来不讨喜 2020-11-27 19:45

Is there any way to use autoboxing for the classes I create? For example, I have this subclass of Number.

public class UnsignedInteger extends N         


        
4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-27 19:53

    No, unfortunately. Automatic boxing conversions (as per JLS §5.1.7) are only defined for the standard primitive wrapper classes.

提交回复
热议问题