java - Can new Double(String) ever return a null? -


this question has answer here:

given code

final double price = new double(somestring); if(price != null <...>) { 

am correct in assuming price can never null here?

read specifications: section 15.9.4 of jls:

the value of class instance creation expression reference newly created object of specified class. every time expression evaluated, fresh object created.

a constructor therefore can never return null. however, java.lang.outofmemoryerror may occur.


Comments

Popular posts from this blog

How can I fetch data from a web server in an android application? -

Change php variable from jquery value using ajax (same page) -

android - java.net.UnknownHostException(Unable to resolve host “URL”: No address associated with hostname) -