Find the value of Math.min
-25.5. - 12.5)
Answers
Java contains a set of built-in math operators for performing simple math operations on Java variables. The Java math operators are reasonably simple. Therefore Java also contains the Java Math class which contains methods for performing more advanced math calculations in Java. This Java math tutorial will take a closer look at both Java's math operators as well as the Java Math class.
Java Math Operators
Let me first explain you the four basic math operators in Java. The Java math operators are:
Math Operator Description
+ Performs addition
- Performs subtraction
* Performs multiplication
/ Performs division
Each of these math operators will be explained in more detail in the following sections.
Addition
The + operator performs an addition of two values. This can be an addition of two constants, a constant and a variable, or a variable and a variable. Here are a few Java addition examples:
int sum1 = 10 + 20; // adding two constant values
int sum2 = sum1 + 33; // adding a variable and a constant
int sum3 = sum2 + sum2; // adding two variables
The + operator will replace the two values with the sum of the two values at runtime. So at the place where the expression sum1 + 33 is written, at runtime this will be replaced with the sum of the value of sum1 and the constant value 33.
Answer:
Your answer is -38!
hope this helps