Key Concepts
The Scanner Class
Formatting
%[flags][width][.precision]conversion
|
Conversion Tag |
Usage Type |
Example |
|
s |
String Literals |
printf("%s","Sam") |
|
d |
ints |
printf("%d", 5182) |
|
f |
doubles |
printf("f", 2.123456) |
Flags
width
Precision
With strings - maximum number of characters to print
With f(doubles) - how many decimals to print (defaults to 6 places)