CS8392
OBJECT ORIENTED PROGRAMMING
CONSTANTS
Presented by:
Manojkumar
Information Technology
II-year
WHAT IS A CONSTANTS?
 Constants mean the fixed values that do not
change during the execution of a program
Example:
=3.14
Constant
Numeric
Constant
Integer
Constant
Real
Constant
Character
Constant
Character
Constant
String
Constant
Constant
Numeric
Constant
Integer
Constant
Real
Constant
Character
Constant
Character
Constant
String
Constant
NUMERIC CONSTANTS
 Numeric Constants are used for representing the
numerical values.
 The numeric values can be
Integer
Real type
INTEGER CONSTANTS
 Integers means sequence of digits . there
are three types
 Decimal Integer:
the decimal integers consist of a set of
digits through 0 to 9
 Octal Integer:
The octal integer consist of a set of 0 to
7
 Hexadecimal Integer:
It consist of 0 to 9 and letters A to F
REAL CONSTANTS
 Real constants contains the floating point parts
Example:
0.045
0.006
Constant
Numeric
Constant
Integer
Constant
Real
Constant
Character
Constant
Character
Constant
String
Constant
CHARACTER CONSTANT
 A single character constant is enclosed within a pair
of single quotes.
Example:
‘a’
‘T’
STRING CONSTANT
 A string is a collection of characters enclosed within
double quotes
 The characters can be alphabets, numbers, white
spaces or special characters.
Example:
“India”
“Best”
THANK YOU

Constants in java