Objects and primitive data.
A primitive data type uses a small amount of memory to represent a single item of data. All data of the same primitive type are the same size.
For example, primitive type
integers using 32 bits.
All variables of type
int use 32 bits.
There are only eight primitive data types in Java:
A Java program cannot define any other primitive data types.
An object is a large chunk of memory that can potentially contain a great deal of data along with methods (little programs) to process that data. There are thousands of object classes that come standard with Java, and a programmer can easily create additional classes. (Although there are thousands of standard classes, for this course you only need become familiar with a dozen or so classes.)
Objects are so useful that we need to start using them now, even though they will not be fully discussed until chapter 25.
Can objects contain primitive data?