Murach's Beginning Java 2, JDK 5
How to work with data

This chapter builds on what you learned in chapter 2 to teach you more about handling data in your Java programs. That includes working with all 8 primitive data types, casting data from one type to another, and formatting data for output.

Chapter 3 How to work with data
Basic skills for working with data 92
The eight primitive data types 92
How to initialize variables 94
How to initialize constants 94
How to code assignment statements and arithmetic expressions 96
How to use the shortcut assignment operators 98
How to work with the order of precedence 100
How to work with casting 102
How to use Java classes for working with data types 104
How to use the NumberFormat class 104
How to use the Math class 106
How to use the Integer and Double classes 108
The formatted Invoice application 110
The code for the application 110
How to analyze the data problems in the Invoice application 112
How to use the BigDecimal class for working with decimal data 114
The constructors and methods of the BigDecimal class 114
How to use BigDecimal arithmetic in the Invoice application 116




Murach's Beginning Java 2

Learn more about this book

Add this book to your cart



Our Ironclad Guarantee

First, try our books for 90 days. Then, if you aren't completely convinced that our books are the best ones you've ever used, you can return them for a full refund...no questions asked.