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








Syntax

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

public static float nextAfter(float start,  double direction)

Example

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

/*from   w  w  w  . j  a  va2  s  . co m*/
public class Main {

  public static void main(String[] args) {
  
    float f1 = 12.3f, f2 = 0.0f;
       
    System.out.println(StrictMath.nextAfter(f1, 9.2d));

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

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

The code above generates the following result.