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

Answer:

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. All data of the same primitive type are the same size.

For example, primitive type int represents integers using 32 bits. All variables of type int use 32 bits.

There are only eight primitive data types in Java: byte, short, int, long, float, double, char, and boolean. 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.)

primitive and object data

Objects are so useful that we need to start using them now, even though they will not be fully discussed until chapter 25.


QUESTION 2:

Can objects contain primitive data?