Online Java Compiler By
JavaTpoint.com
public class NextAfterExample2 { public static void main(String[] args) { float a = 787.843f; double b = 345.56; // print the next number for a towards b System.out.println(Math.nextAfter(a, b)); } }
Output