New course! Every coder should learn Generative AI!
Try a free lesson0
Math.rint(4.5)
Java
3 Answers
+ 1
4.0
+ 5
Math rint returns a value that is closest in value to the argument provided and is an integer! It returns double values (a data type for decimal values). You can say it rounds off the number.
+ 1
Hi Chetan Singh the Math.rint() is similar to a Math.round() but returns a floating point value. For cases where you have 0.5 in the decimal place then it will round to the nearest even value.