Using % with floating-point primitives produces results similar to the integer operation the special floating-point values, such as NaN and POSITIVE_INFINITY, can result. public class MainClass { public static void main(String[] argv) { System.out.println(1.2 % 3); } }
1.2
public class MainClass{ public static void main(String[] argv){ double i=9D; double j=2D; double z = i % j; System.out.println(); } }
1.0