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

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -