O'Reilly logo

Java™ for Programmers: Deitel Developer Series, Second Edition by Harvey Deitel - Deitel & Associates, Inc., Paul Deitel - Deitel & Associates, Inc.

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Appendix G. Formatted Output

All the news that’s fit to print.

Adolph S. Ochs

What mad pursuit? What struggle to escape?

John Keats

Remove not the landmark on the boundary of the fields.

Amenehope

Objectives

In this appendix you’ll learn:

• To understand input and output streams.

• To use printf formatting.

• To print with field widths and precisions.

• To use formatting flags in the printf format string.

• To print with an argument index.

• To output literals and escape sequences.

• To format output with class Formatter.

G.1 Introduction

G.2 Streams

G.3 Formatting Output with printf

G.4 Printing Integers

G.5 Printing Floating-Point Numbers

G.6 Printing Strings and Characters

G.7 Printing Dates and Times

G.8 Other Conversion ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required