go to previous page   go to home page   hear noise   go to next page


Objects and primitive data.

Objects and Primitive Data

A primitive data type uses a small amount of memory to represent a single item of data using bit patterns. For example, primitive type int represents integers using 32 bits. There are only eight primitive data types in Java: byte, short, int, long, float, double, char, and boolean. It is not possible for a Java program to define any other primitive data types.

primitive and object data

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. The others are used for advanced programming.)

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?