29.8. Other Conversion Characters

The remaining conversion characters are b, B, h, H, % and n. These are described in Fig. 29.10.

Figure 29.10. Other conversion specifiers.
Conversion characterDescription
b or BPrint "true" or "false" for the value of a boolean or Boolean. These conversion characters can also format the value of any reference. If the reference is non-null, "true" is output; otherwise, "false" is output. When conversion character B is used, the output is displayed in uppercase letters.
h or HPrint the string representation of an object’s hash-code value in hexadecimal format. If the corresponding argument is null, "null" is printed. When conversion character H is used, the output is displayed in uppercase letters.
%Print the percent ...

Get Java™ How to Program, Seventh Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.