简体   繁体   English

new Double(someString)和Double.parseDouble(someString)有什么区别

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

As far as I can tell new Double(someString) and Double.parseDouble(someString) give me the exact same result. 据我所知, new Double(someString)Double.parseDouble(someString)给出了完全相同的结果。 Is there any reason I would want to use one over the other? 有什么理由我想用一个而不是另一个吗?

One returns Double ; 一个人返回Double ; the other, double . 另一个, double

The differences between primitive Java types and their wrapper counterparts are discussed, for example, here . 例如, 这里讨论了原始Java类型与其包装对应物之间的差异。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM