Tino APCS

Primitive Data Types

Lesson Overview: When designing a class, one of the programmer's jobs is to define the attributes of the class. Java allows two different types of attributes: objects and primitive data types. Using objects as attributes will come naturally as you become more used to OOP. Java provides several primitive data types to store basic information and uses objects to fill in gaps that are not provided with the primitive data types. Java is a richly typed language, which means that it gives the programmer a wide variety of data types to use. As the name suggests, primitive data types are very basic in nature. In this lesson you will declare variables, store values in them, learn operations to manipulate and use those values, and print out the values using the System.out object.

Lesson Vocab
ASCII

The American Standard Code for Information Interchange is a character encoding standard for electronic communication, representing characters as numbers.

ASSIGNMENT OPERATOR

(=) Assigns the value of the expression on the right to the variable.

boolean

A data type that has one of two possible values (true/false), from Boolean algebra.

char

A data type representing a single ASCII character.

DECREMENT OPERATOR

(--) Decrements (decreases) a value by one.

double

A data type representing any signed or unsigned number with a decimal point.

ESCAPE SEQUENCE

Special codes used to print unusual or reserved characters, such as quotes. They being with a \.

float

A data type representing a floating-point number. Less precise than a double.

INCREMENT OPERATOR

(++) Increments (increases) a value by one.

IDENTIFIER

A programmer-defined name used to reference classes, methods, constants, variables, or anything a programmer is required to define.

int

A data type representing an integer.

MODULUS OPERATOR

(%) Calculates the remainder of division between two integers or decimal numbers.

PRECEDENCE

Rules governing the order in which a mathematical expression is solved. Similar to the mathematical order of operations.

PRIMITIVE DATA TYPE

Colloquially referred to as "primitives", these are raw data containers provided by the native Java SDK.

RESERVED WORDS

Certain keywords reserved by Java that cannot be used as identifiers. (ex: import, new)

STRING LITERAL

Hard-coded characters enclosed within double quotation marks, representing a String.

TYPE CONVERSION

Converting a variable from one data type to another. In the context of numbers, high-to-low precision requires typecasting, while low-to-high is done automatically.