I'm doing at a tutorial on Oracle website and still following it so far. I have come across this formatter "%,8d" and can't seem to work out how it works. I know it's adding a coma to the integral number. The thing that I can get my head around is the decimal place isn't specified. I wonder how the compiler knows where to put the comma?
The last line is used to add a plus sign. Well, what If I wanna add a minus sign?????
"%-" that didn't work for me.
long n = 461012; // --> " 461,012" System.out.format("%,8d%n", n); // --> "+461,012" System.out.format("%+,8d%n%n", n);