Advertisement
Guest User

Printf Examples

a guest
Apr 11th, 2015
1,691
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.23 KB | None | 0 0
  1. System.out.printf("%-4.3f%n",123.45); // left justified, 3 decimal places
  2. System.out.printf("%,07d%n",2124); // zero-padded with comma delimiter
  3. System.out.printf("%b", null); // prints false
  4.  
  5. Output:
  6. 123.450
  7. 002,124
  8. false
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement