Closed j143 closed 3 years ago
Conversion characters:
character | type |
---|---|
%f |
decimal point accuracy of doubles |
%d |
format spacing for integers |
%c |
format spacing for characters |
%s |
format Strings |
%n |
adds a newline character (\n ) |
double d = 3.1415;
int i = 3;
char c = 'a';
String s = "Hello World";
System.out.printf("%.3f%n", d);
System.out.printf("<%3d>%n", i);
System.out.printf("%c%n", c);
System.out.printf("%s ", s);
[1] https://www.cs.colostate.edu/~cs160/.Summer16/worksheets/Week01/Printf.pdf
https://github.com/j143/query-spanner-with-java/blob/c85902d722188f83a3e2fc244c51e1b68f7356a7/spanner-with-java/src/main/java/page/janardhan/labs/App.java#L108-L110