Introduction
A programming language is designed to process certain types of data consisting of numbers, characters and strings and to provide useful output as Known information. The task of processing data is accomplished by executing a sequence of instructions contributing a program. These instruction are formed using certain symbols and words according to some rigid rules known as syntax rule of the language.
Constant
Constants in java refer to fixed values that do not change during the execution of a program. Java supports several types of Constants as given below.
-
Integer Constant
- 123 -321 0 654321
-
Real Constant
- 0.083 -0.32 453.23
-
Single Character Constant
- ‘5’ ‘x’ ‘:’ ‘ ‘
-
Backslash Character Constant
- Java supports some of special backslash character constants as given below
| Constant | Meaning |
| '\b' | back space |
| '\f' | form feed |
| '\n' | new line |
| '\r' | carriage return |
| '\t' | horizontal tab |
| '\'' | single quoted |
| '\"' | double quoted |
| '\\' | backslash |
Variables
A variable is an identifier that denotes a storage location used to store a data value. Unlike constant that remains unchanged during the execution of a program, a variable may take different values at different times during the execution of the program.
Variable names are consist of alphabets, digits, the underscore ( _ ) and the dollar character, subject to the following conditions:
- They must not begin with digits.
- Uppercase and lowercase are distinct. This means that the variable Total is not the same as total or TOTAL.
- It should not be a keyword.
- White space is not allowed.
- Variable names can be of any length.
Data types
Every variables I java has a Data types specify the size and type of values that can be stored. Java language is rich in its datatypes. The variety of data types available allows the programmer to select the type appropriate to the needs of the application. Data types in Java under various categories are also called intrinsic or build-in types.

