java - How to multiply a double and an int and cast to int in single statment -


i'm trying accomplish following without luck

int = 1; double b = 0.5;  int myinteger = (int) a*b;  

you've declared b integer.

try this:

int = 1; double b = 0.5d; int myinteger = a*b; 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -