The Math class API states -public static double rint(double d) this method returns a double value that is closest in value to the argument and is equal to a mathematical integer. -public static long (or int) round(double d) this method returns closest long (or int) to the argument. Could any one tell me what exactly the difference between these two methods apart from their return types? Thankyou Mallik HM [ November 02, 2002: Message edited by: Mallik HM ]
Be sure to read the long descriptions, not just the short ones. The functions produce different results when the argument is exactly halfway between two integers. round() rounds up, but rint() rounds to an even integer.
Howdy all -- just wanted to point out that the exam objectives require *only* the following methods: abs, ceil, floor, max, min, random, round, sin, cos, tan, sqrt, toDegrees, toRadians And that's it! Don't know about you, but I'm much too lazy to study more than I need to , so for all of you who're overwhelmed as it is, the list above is all that's required of the Math class in the exam. Cheers, Kathy of course, feel free to study more
Co-Author of <a href="http://www.amazon.com/exec/obidos/ASIN/0596007124/ref=jranch-20" target="_blank" rel="nofollow">"Head First Design Patterns"</a><br /> <br />Just a Jini girl living in a J2EE world.