Chapter 2

Applying Data Types in Java Programming

In the examples in Chapter 1, you saw casual use of data types to help you understand Java class structure. Now we dig in a bit deeper to understand the two basic types of data we have in Java, objects and primitives. As you learn about them, you’ll get a better understanding of the rules that support them and the cases the drive their use.

We’ll also take our first look at two key Java classes, String and StringBuilder, which you’ll need quite frequently in everyday programming.

In this chapter, we’ll cover the following topics:

  • Creating, using, and destroying objects
  • Distinguishing between object references and primitives
  • Declaring and initializing variables
  • Default initialization of variables ...

Get Java SE 7 Programming Essentials 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.