Page 144 - Computer science 868 Class 12
P. 144
05 PRIMITIVE VALUES,
WRAPPER CLASSES, TYPES
AND CASTING
Learning Objectives
5.1 Data Types 5.2 Arithmetical Expressions
5.3 Type Casting 5.4 Wrapper Class
To write codes in Java, different characters such as alphabets, digits and special characters are used. The different
combinations of these characters are used to declare variables, keywords and symbols which are required to write a
whole program. These are known as Character Sets of Java. They are also called Unicode Character Sets.
Compilers use these character combinations to store variables in the allocated memory space. This phase is known as
the storage assignment phase. Here, the compiler creates a fixed length for storing different types of variables having
different data types described in the Java language. A data type is a classification of data that is required to inform both
the compiler and interpreter the way what the variable is going to store.
5.1 DATA TYPES
The data type in Java indicates the way the values of the variable are saved in memory. Thus, each variable must be declared
with a data type that will decide what type of value the variable will hold. In Java, there are two kinds of data types. They
are Primitive data types and Non-Primitive data types which are further classified into sub-types as shown below.
Data Types
Primitive Non-Primitive
Floating
Integer point Character Boolean Class Array Object
float char boolean
byte short int long
double
142142 Touchpad Computer Science-XII

