
Transitioning to Java
By :

The heart of every program you will write is the data that your program operates on. In this chapter, we have learned about the eight primitive types. There is byte
, particularly useful if you are writing software to interact with other devices. short
, int
, and long
are useful when what you need to describe has no fractions. When there are fractions, however, you can use floating-point types – float
and double
. The char
type is the building block for strings. If you want to keep track of what is true or false, you should use the boolean
type.
As you move forward into Java, always keep in mind the available data types. Just as important is to understand what will happen if a value is out of range.
Having identified the types, we moved to identify variables with meaningful names. We discussed how we assign data to these variables, and how we use them was an important part of this chapter.
We left the primitives briefly to look at classes that are closely associated...