0% found this document useful (0 votes)
15 views

Java 2

Math class provides static methods for numeric operations like exponents, logs, max, min, rounding and absolute values. It contains methods like abs(), pow(), sqrt(), cbrt(), max(), min(), ceil(), floor(), round(). The Java if statement checks boolean conditions true or false and there are different types like if, if-else, if-else-if ladder, and nested if statements. Conditional operators include <, <=, >, >=, ==, !=.

Uploaded by

Aba Sige
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Java 2

Math class provides static methods for numeric operations like exponents, logs, max, min, rounding and absolute values. It contains methods like abs(), pow(), sqrt(), cbrt(), max(), min(), ceil(), floor(), round(). The Java if statement checks boolean conditions true or false and there are different types like if, if-else, if-else-if ladder, and nested if statements. Conditional operators include <, <=, >, >=, ==, !=.

Uploaded by

Aba Sige
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

MATH CLASS

CC203 COMPUTER PROGRAMMING 2


Math class
provides helpful static methods for
performing numeric operations such as
exponential, logarithm, etc.
abs()
The abs() method returns the absolute value of a given value.
pow()
Calculates and returns the value of the first argument raised to the power of
the second one.
sqrt()
Returns the rounded positive square root of a double.
cbrt()
Similarly, cbrt() returns the cube root of a double.
max()
As the method's name suggests, it returns the maximum between
two values.
min()
In the same way, min() returns the minimum between two values.
ceil()
To round a number to the largest double that is greater than or
equal to the argument.
floor()
To round a number to the largest double that is less than or equal
to the argument.
round()
To round a number to the nearest one.
Java If-else Statement
The Java if statement is used to test
the condition. It checks boolean
condition: true or false.
There are various types of if
statement in Java.

• if statement
• if-else statement
• if-else-if ladder
• nested if statement
Conditional Operators
• Less than: <
• Less than or equal to: a <= b
• Greater than: a > b
• Greater than or equal to: a >= b
• Equal to a == b
• Not Equal to: a != b

You might also like