What is the difference between new Double(someString) and Double.parseDouble(someString)

岁酱吖の 提交于 2019-12-10 13:33:45

问题


As far as I can tell new Double(someString) and Double.parseDouble(someString) give me the exact same result. Is there any reason I would want to use one over the other?


回答1:


One returns Double; the other, double.

The differences between primitive Java types and their wrapper counterparts are discussed, for example, here.



来源:https://stackoverflow.com/questions/9004370/what-is-the-difference-between-new-doublesomestring-and-double-parsedoublesom

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!