Objects and Primitive Data

Classic programmed-learning exercises, refreshed for modern Java and presented in the current MrStyner.com portfolio style.

Modern Java noteThis archive has been refreshed for Java 25 LTS. Core language concepts remain useful, while outdated setup instructions and browser-era Java are labeled or replaced. Java 26 is the current feature release; Java 25 is used here as the stable teaching baseline.
go to previous page   go to home page   hear noise   go to next page

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 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.

QUESTION 2:

Can objects contain primitive data?