Java Data Type Tutorial - Java StrictMath.nextAfter(double start, double direction)








Syntax

StrictMath.nextAfter(double start, double direction) has the following syntax.

public static double nextAfter(double start,  double direction)

Example

In the following code shows how to use StrictMath.nextAfter(double start, double direction) method.

//from  ww  w  . jav  a 2 s  .c  o  m
public class Main {

  public static void main(String[] args) {
  
    double d1 = 123.4d, d2 = 0.0d;
       
    System.out.println(StrictMath.nextAfter(d1, 9.2d));

    System.out.println(StrictMath.nextAfter(d2, 9.2d));

    System.out.println(StrictMath.nextAfter(d2, 0.0d));
  }
}

The code above generates the following result.