
3.2 Java Basics and Control Loops
3.2 Constants/Literal Constants
They do not change their value during running of the program. Note that constants are also
called literal constants and are presented in Figure 3.1.
3.2.1 Integer Constants
They can be subdivided into
i) Decimal integer constants: 0 10 −745 999
Example: int myAge=56; // 56 is in decimal
ii) Octal integer constants: Only digits between 0 and 7 are allowed. All octal numbers
must start with 0 digit to identify as octal number.
Allowed octal constants: 0777, 001, 0116, 07565L (octal long)
Illegal octal constants are: 089 − 8 is illegal, 777 − does not start with 0
: -0675.76 − . ...