Java Reference
In-Depth Information
2
Console Input
and Output
2.1 SCREEN OUTPUT
58
System.out.println
58
Formatting Output with
printf
61
Money Formats Using
NumberFormat
★
67
Importing Packages and Classes 70
The
DecimalFormat
Class
★
2.2 CONSOLE INPUT USING
THE
Scanner
CLASS
76
The
Scanner
Class 76
The Empty String 84
Example: Self-Service Checkout 86
Other Input Delimiters 87
72
2.3 INTRODUCTION TO FILE INPUT
89
The
Scanner
Class for Text File Input 89
Chapter Summary 92
Answers to Self-Test Exercises 92
Programming Projects 95