I have a problem understanding how the formatting in the printf method is working.
The following method:
gives the output: +07 252. Why it is not: +07,252? Why it does not display ","?
Also returns: > (123)<, Why it does not display a sign (-)?
int i1 = -123; System.out.printf(">%1$(7d< \n", i1);
Note 2 leading spaces before open braces
Preparing for SCJP
Joined: Jul 12, 2010
Vicky, Shanky thanks for the answer.
I understand the second case, but still I don't get why in the in the first case the "," is not displayed.Could you elaborate more please?
Joined: Jul 15, 2010
If the ',' ('\u002c') flag is given, then the locale-specific grouping separator is inserted by scanning the integer part of the string from least significant to most significant digits and inserting a separator at intervals defined by the locale's grouping size.