3 Lesson Concept of Data Types in Java
3 Lesson Concept of Data Types in Java
And
Types
What are
Tokens ?
Each individual
character as well as
punctuation marks used
in statement / sentence
is known as Token. .
Identifie
rs
Tokens
Punctuat
ors
Operator
s
What are
Literals ?
Literals are
constants.
Constants means
fixed data value (i.e.:
which do not change).
Real
Literals
Charact
er
String
Integer
Literals
Numbers which are
represented without
decimal point are integer
literals.
A group of characters
enclosed within a pair of
opening & closing double
quotes is known as string
What
are
Punctuators
Punctuators are the
punctuation signs used
as special characters in
Java.
. (full stop)
(Underline)
? (Question mark)
What
are
Separators
The special
characters , which are
used to separate the
characters or variables
are called as
separators.
What
are
Identifiers
Identifiers are called
as variables in Java.
A variable is a named
memory location ,which
contains a value.
The value of a
variable can change
Integer
Numeric
Types
Floating
Variables
Charact
er
Non-
Numeric
Types
String
Integer Type :
• It holds all whole
numbers having positive
or negative values.
• The data type (int ) is
used with the variable to
int a ;
declare it.
data type
Variable to store an integer type valu
Floating Type :
• It stores all real
numbers (decimal
numbers).
• The data type (float) is
used withfloatthemvariable to
;
declare it.
data type
Variable to store a floating type value
Character Type :
• It holds only one
character
(alphabet ,digit, special
characters).
• The data type (char) is
char
p ;
used with the variable to
declare
data type
it.
Variable to store a character
String Type :
• It stores more than one
character
(word ,sentence ,paragra
ph).
• The data type (String)
String
p ;
is used with the variable
to declare it.
data type
Variable to store a string
Data Types
in
Java
In Java ,we have to deal
with various types of
data ,hence it becomes
necessary for a
programmer to select
appropriate data type
according to data taken.
Classe Interfa
Arrays
s ce
Numeri Non-
c Numeric
Types Types
Intege Floati
Characte Boolea String
rs ng
rs n s
Primitive data types
• These are also called as
Basic Data Types.
• They are predefined or
built-in in nature .
• E.g. : byte , int , long ,
float , double , char , short ,
boolean .
2) Distinguish between :-
a) Integer and Floating Literal
b) String and Boolean Literal