Do we have to put int in front of math class method every time we put in the command line ?

For example, System.out.print((int) Math.

Thank you.

+11 votes

I don't think we need to put int every time we put the command line. (int) only helps you to make the result of the math class method become an integer so I think the decision is based on the result we want and the math class method. If the math class method creates a double result and we need an integer, we need (int) because we need to transfer from double to integer. But if the math class method creates an integer result and we need an integer, we don't need (int) because the result is already an integer.