Data Types
In this lesson, we will explore how to specify the data type a Java program uses.
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 first program we showed you earlier is so simple, we will look at other Java examples as we discuss the topics in this lesson.
Get hands-on with 1400+ tech skills courses.