%s
is a string in printf
, and %d is a decimal I thought...yet when putting in
writer.printf(\"%d dollars is the balance of %s\\r\\
Yes, %d is for decimal (integer), double expect %f. But simply using %f will default to up to precision 6. To print all of the precision digits for a double, you can pass it via string as:
System.out.printf("%s \r\n",String.valueOf(d));
or
System.out.printf("%s \r\n",Double.toString(d));
This is what println do by default:
System.out.println(d)
(and terminates the line)