Home >>Java Math Methods >Java Math.log() method
The Math.log() Method in Java Math is used to find out any number's Logarithmic Value. This method returns a double value as a parameter of the natural logarithm (base e).
public static double log(double x)
x= This parameter is used for a value entered by user
It is used to returns the value In a, the natural logarithm of a.
public class MyClass
{
public static void main(String[] args)
{
double a = 12.5;
System.out.println(Math.log(a));
}
}
public class MyClass
{
public static void main(String[] args)
{
double a = -23.7;
System.out.println(Math.log(a));
}
}