How do I convert a basic reference type variable to a primitive one?

coder-coder :

I have two variables: Double x and double y. I would like to assign x's value to y, but obviously there is an "incompatible types" error that is shown in a simple y = x expression. y = (double) x does not work properly either. How can I solve this if it's generally possible?

Guy :

You can use doubleValue()

double y = x.doubleValue();

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=18656&siteId=1