Register / Login
this forum made possible by our volunteer staff, including ...
Roel De Nijs
Stephan van Hulst
Programmer Certification (OCPJP)
printf(String, Object) and format(String, Object) methods
posted 9 years ago
According to K&B book, the format
be as follows:
[Array index] [Flags] [Width] [.Precision] [Conversion]
And the array index is starting from 1: 1$, 2$ ...
Flags: +, - , 0, , , (
Width: integer number
Conversion: b, c, d, s, f
My question is:
How many flags can be used in combination? I have tried and it seems to m that maximum only 2 flags in be used together.
For example: System.out.printf("%2$(010d*", "Hello", -200);
How does the compiler interpret the format string from left to right? For example: how does it differenciate between flags and width and conversion etc.
Did you see how Paul
cut 87% off of his electric heat bill with 82 watts of micro heaters
Boost this thread!
Printing the index of an array
printf, multiple flags
Regarding printf() method
How to convert old java I/O code to nio ...