Rounding off a value means replacing it by a nearest value that is approximately equal or smaller or greater to the given number.
y = (int)(x + 0.5); here x is any float value. To roundoff, we have to typecast the value of x by using (int)
Example:
#include
int main ()
{
float x = 2.6;
int y = (int)(x + 0.5);
printf ("Result = %d\n", y );
return 0;
}
Result : 3
Two main measures for the efficiency of an algorithm are Time and Space.
The Math.floor() function in JavaScript is used to round off the number passed as parameter to its nearest integer in Downward direction of rounding i.g towards the lesser value.
Hence, math.floor(3.6) = 3.
A is incorrect. It is acceptable to use assertions to test the arguments of private methods.
B is incorrect. While assertion errors can be caught, Sun discourages you from doing so.
Once a method declared as Final cannot be overriden
Copyright ©CuriousTab. All rights reserved.