Hot

Sharly

Friday, August 23, 2013

Constants, Variables, and Data Types



Constants

Fixed values that do not  change during the execution of a program. Java supports several  types of  constants.

Integer  -           An integer constant refers to a sequence of digits. There are three
types of integers.


·        Decimal integer Ex:       137
·        Octal integer                 Ex:       037
·        Hexadecimal integer      Ex:       ox2

Real                             Ex:       0.0083


Character                     Ex:       ‘X’


Variables

A variable is an identifier that denotes a storage  location used to store a data value Unlike  constants that  remain  unchanged  during the execution  of a program. A variable may take different values at different  times  during  the execution  of the program.

Some variables names are:

            Mean
            Medium
            Height


Data Types

Every variable  in Java has a data type. Data types in java  under various   categories

  • Integer Type
  • Floating Point Type
  • Character Type
  • Boolean Type

No comments:

Post a Comment