What is the difference between math floor and math round?



What is the difference between math floor and math round?..

Answer / Neeraj Nikhra

"The Math.floor() method in Java rounds a number downwards to the nearest integer, while the Math.round() method rounds a number to the closest integer (either up or down depending on the decimal value). For example, Math.floor(5.8) returns 5 and Math.round(5.5) returns 6."

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

What is communist flag?

1 Answers  


What are the two types of streams offered by java 8?

1 Answers  


what do you mean by classloader?

1 Answers  


What is the purpose of the file class in java programming?

1 Answers  


What is the difference between error and exception and explain in simple words not whatever is given in the book.

7 Answers  


Write the algorithm to check the number non-leaf nodes in a tree.

1 Answers   Amdocs,


What are wrapped classes?

7 Answers   Samsung,


How does enum work in java?

1 Answers  


How do you do descending order in java?

1 Answers  


What will happen if there is a default method conflict as mentioned above and we have specified the same signature method in the base class instead of overriding in the existing class ?

1 Answers  


How do you override a method?

1 Answers  


what is comparable and comparator interface?

1 Answers  


Categories