Flash cards
Review the key moves
1/4
Core idea
What is the main idea behind Java Math log() Method?
Lesson checks
Practice each idea before moving on
Short Mimo-style checks built from this lesson's code, terms, and sequence.
1Quick choice
Which statement best captures the main point of this lesson?
2Fill blank
Complete the missing token from the example code.
___.out.println(Math.log(6));3Order
Put the learning moves in the order that makes the concept easiest to apply.
The log() method returns the natural logarithm of a number.
Definition and Usage
Java Math log() Method
❮ Math Methods
Example
System.out.println(Math.log(6));
System.out.println(Math.log(Math.E));
System.out.println(Math.log(2));
System.out.println(Math.log(1));
System.out.println(Math.log(0));
System.out.println(Math.log(-1));Definition and Usage
The log() method returns the natural logarithm of a number.
The natural logarithm is the logarithm with base e . The value of e is approximately 2.718282 and it is available as the constant Math.E in Java.
Syntax
public static double log(double
number )Parameter Values
| Parameter | Description |
|---|---|
| number | Required. Specifies the value to calculate the logarithm for. If the value is negative, it returns NaN (Not a Number). If the value is 0, it returns -Infinity. |
Technical Details
| Returns: | A double value representing the natural logarithm of a number. |
|---|---|
| Java version: | Any |