Primitive Data Types and Classes

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.
Historical topic: Java appletsModern web browsers do not run Java applets. The Applet API was deprecated for removal before Java 25 and was removed in Java 26. Treat applet examples on this page as historical object-oriented/GUI examples; for new desktop interfaces use Swing where appropriate or JavaFX/OpenJFX.
go to previous page   go to home page   go to next page        

Answer:

(Review:) In Java, a piece of data either is of a primitive data type or is an object data type.

Primitive Data Types and Classes

two types of data

Chapter eight discusses the idea of a data type:

Computer memory stores bit patterns. A particular pattern has meaning only when you know what type of value it represents, and what scheme is being used to represent values with patterns. The scheme that is being used for a particular section of memory is a data type.

If these ideas have gotten fuzzy, you may wish to review chapter eight.

Java has many data types built into it, and you (as a programmer) can define as many more as you need. Other than the primitive data types, all data types are classes. In other words, data is either primitive data or object data. The only type of data a programmer can define is an object data type (a class). Every object in Java is an instance of a class. The class definition has to exist first before an object can be constructed.


QUESTION 2:

(Review:) In the table decide on the classification for each data type.

Data TypePrimitiveClass
int
String
long
double
Applet
boolean
Scanner