Java Reference
In-Depth Information
Flag
e/E f/F g/G
a/A
Meaning
Enclose negative values in par-
entheses
'('
x
As with the integer conversions, you cannot use
+
and space together,
nor can you use and
0
together. If either of
0
or is given then a width
must be given.
22.1.4. Character Conversions
The character conversions apply to argument types of
byte
,
short
,
and
char
, together with
int
provided that the
int
value represents a
valid Unicode code point (otherwise
IllegalFormatCodePointException
is
thrown).
The conversion indicator for characters is
c
or
C
and formats the argu-
ment as a Unicode character.
A width value specifies the minimum number of characters to output,
with spaces used to pad the output as necessary. No precision value
may be supplied. The only applicable flag is to left-justify the output. If
the flag is given then a width must be given.
22.1.5. General Conversions
There are three general conversions that are unrelated but that are not
numeric or character conversions, so we describe them together. They
apply to an argument of any type.
The
b
and
B
conversions are boolean conversions. If the argument is
null
then the output is the string
"false"
. If the argument is a
boolean
then