I see this code and I'm wondering how many bytes it takes up:
// Create a PrintWriter by wrapping it around a FileWriter
PrintWriter output = new PrintWriter( new FileWriter( f, true) );
output.printf( "%-8s %-15s %10.2f %n", "P-102", "PartNumber102", 8.25 );
output.printf( "%-8s %-15s %10.2f %n", "P-103", "PartNumber103", 12.15 );
output.close();
How many bytes will `P-102 take up? It seems like it only has 5 characters so 5 bytes right? But what does the 8 mean? I think the dash is left justified and the s is a string... but what does the 8 mean?
Same thing for PartNumber103
which has 13 characters so 13 bytes? Why does it seem to take up 15 bytes?