What is the output of the following code?
public class Main { public static void main(String[] args) { System.out.printf("%.2e %n", Double.NaN); System.out.printf("%.2f %n", Double.POSITIVE_INFINITY); System.out.printf("%.2g %n", Double.NEGATIVE_INFINITY); System.out.printf("%(f %n", Double.POSITIVE_INFINITY); System.out.printf("%(f %n", Double.NEGATIVE_INFINITY); } }
NaN Infinity -Infinity Infinity (Infinity)
If the argument value for a floating-point conversion is NaN or Infinity, the output contains the strings "NaN" and "Infinity", respectively.