Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- System.out.println("Example 1: Precision");
- double temp = 78.42819;
- System.out.printf("The temperature is %.2f degrees",temp);
- System.out.println("Example2 : Precision");
- double value1 = 123.45678, value2 = 123.45678, value3 = 123.45678;
- System.out.printf("%.1f %.2f %.3f\n",value1, value2, value3);
- //% - format specifier
- //._ - precision
- //f - value
Add Comment
Please, Sign In to add comment