Data Types
In this lesson, we will explore how to specify the data type a Java program uses.
We'll cover the following...
We'll cover the following...
Why do we need data types?
Computers process various kinds of data. For example, an application might use numbers that contain a decimal point, integers, individual characters, and strings. The Java compiler needs to know what kind of data it is working with, and so the programmer needs to specify a data type. For example, we would use the data type
int
for integerschar
for charactersString
for strings
As we will see, Java’s data types are organized into two categories
- Primitive types
- Reference types
Because the ...