answersLogoWhite

0


Best Answer

The Math.round() method is used to round off a decimal value to its nearest whole number.

If the value beyond the decimal point is > 0.5 then the next number would be returned. Similarly if that value is < 0.5 then the previous value number be returned.

For example Math.round(2.75) would yield an output of 3 whereas Math.round(2.25) would yield an output of 2.

User Avatar

Wiki User

15y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What does a round method return in a Java program?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is the return type of finally method in java?

The final and finally keywords have no impact on the return type of a method in Java.


How many values can a method return in Java?

A method in java can declare only one return value and type at a time. For ex: a single method cannot have a code that returns a string in some cases and an integer in other cases. Java compiler does not let you do that. You can only have one return type for every method in java.


What does a void method do?

In Java, this keyword is used to specify that the method has no return value.


What will happen if a Java Class has no Main Method?

Nothing will happen. There is no restriction that every Java class must have a main method. The only program is that, this class cannot be executed as a standalone java program.


Java program to check A is divisible by B?

Implement this method: public static boolean isDivisible(int a, int b) { if(a % b == 0) { return true; } else { return false; } }


Why should the java main method has the return type as void?

A void method is one that returns no value. The Java main() method is the first method to be called, therefore it doesn't need to return a value to another Java method, therefore it is declared as void. If something needs to be returned to the operating system, this is done differently, not by "returning a value" in the sense of Java.


What is default return type for method in java?

default return type is : true


What is the return keyword in Java?

this is the type of the value that the method returns to its caller


Can the return type of a method be an array?

Depends on the language. For Java, yes.


Can you run java program without applying main method?

yes we can run java program without using main. we can run program by declaring the variable static..


Can return statement be in a void method in java?

the main method in java is the client code therefore doesn't return any values Unlike languages like C/C++, the user doesn't specify an error return code by returning from the main method. Instead they should use System.exit(code) to do this. If the Java main method returns, the default code of zero is returned.


Why use void in main of java?

No. void is not a data type. It is mandatory for all java methods to return something and if it is not going to return anything, we have to mark the method with a "void" return type to let the JVM know that it must not expect anything from the method.