Wednesday, March 18, 2009

What Is A Constant?

A constant is a any data that cannot be changed. In JAVA, constants can be of any basic eight data types.
For example,
  • -23 is a byte constant.
  • 3213 is an integer constant.
  • 13.654 is a float constant.
  • true is a Boolean constant.

Integer constant can also be represented in octal and hexadecimal forms. An octal number should begin with the digit 0 and can contain the digits 0 to 7. A hexadecimal must start with the character sequence 0x and can contain the digits 0 to 9 and the alphabets A,B,C,D,E and F.

No comments:

Post a Comment