java Long datatype comparison

前端 未结 4 650
别那么骄傲
别那么骄傲 2020-12-15 03:41

Why does the code below return false for long3 == long2 comparison even though it\'s literal.

public class Strings {

    p         


        
4条回答
  •  一向
    一向 (楼主)
    2020-12-15 04:14

    You could also get the primitive value out of the Long object using:

    str.longValue()
    

提交回复
热议问题