Java Primitive Object Types
Java Basics - Part 3
Forward: In this part of the series, I explain the basics of what is called primitive object types.
By: Chrysanthus Date Published: 1 Sep 2012
Introduction
Note: If you cannot see the code or if you think anything is missing (broken link, image absent), just contact me at forchatrans@yahoo.com. That is, contact me for the slightest problem you have about what you are reading.
Object
The computer memory is a series of cells, and each cell can store one English language character. We say each cell can store a byte (e.g. A or B or C, etc.). In this part of the tutorial series, I explain primitive or fundamental objects in Java. Any number such as 538, stored in memory is called a datum. The plural of datum is data. Data are of different forms, not just numbers. A datum is stored in memory in a short series of consecutive cells. A primitive object is the region (small group of consecutive cells) in memory holding a datum. In this part of the series we look at the basics of different values that a primitive object can hold.
The cells of the computer memory are numbered numerically. These numbers are called memory addresses. I will not use memory addresses in these tutorials, but it is good for you to know that they exist. I will use them indirectly.
Time to have a look at the primitive (fundamental) object types. You can call object types, data types
An integer abbreviated, int in Java can be the value of an object. In other words the value (content) of an object can be of type Integer. An integer is a whole number, e.g. 6987 or -6987. There are classifications of the integer, but I will not go into that in this series.
double
In Java, a double (type) is a number with a decimal point, e.g. 45.36. There are several ways of writing doubles in Java but I will not go into that in this basic tutorial series. I talk about double in general terms here. There are two classifications of double in Java, but I will not go into that in this basic tutorial series. The value of an object can be a double.
char
Character abbreviated, char in Java is a character, e.g. A, a, B, b, 1, 3, 5, etc. It also includes Chinese type of characters. The value of an object can be a character. Such an object is two bytes long, and will be stored in two consecutive cells in memory. Whenever, we talk about the char object type in Java, we are talking about one single character of two bytes length. The two byte length is used to store one character for both the English language and the Chinese language (and other languages).
boolean
There is something called, boolean. In life a Boolean value is either true or false. An object can hold a boolean type, which is true and alternatively false.
void
This is not officially a data type in Java. However, when the type of datum in an object is said to be void, it means that the region of the object is empty. This empty region is not reserved for an int, double, or any of the other object types.
Let us end here for this part of the series. We continue in the next part.
Chrys