I wrote
return java.lang.Math.round(someVariable*1.234234);
into eclipse in a function which returns an int but it wanted me to include (int) to make it like this
return (int) java.lang.Math.round
What is this (int) doing?
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Well if you look at the Docs,
http://docs.oracle.com/javase/7/docs/api/java/lang/Math.html
Math.roundreturns a long when it’s parameter isn’t a float.So you have to cast the long to an int.