App.java
package com.sample.app; public class App { public static void main(String args[]) { double value = 1234567890; System.out.println("value: " + value); } }
Output
value:
1.23456794E9
As you see
the output of the program, ‘System.out.println’ method prints the value of a double
in scientific notation. If you want to print the value without scientific
notation use ‘System.out.printf’ method.
System.out.printf("value:
%f\n", value);
App.java
package com.sample.app; public class App { public static void main(String args[]) { double value = 1234567890; System.out.println("value: " + value); System.out.printf("value: %f\n", value); } }
Output
value:
1.23456794E9
value:
1234567890.000000
You may
like
No comments:
Post a Comment