An integer constant refers to a sequence of digits.Their are three types of integer
* Decimal Integer
Decimal integer consist of set of digit, 0 through 9. Example of decimal integer constants are: 156 -321 0 45689
Note : Embeded spaces, commas, and non-digit character are not permited between digits.
# Octal Integers
An octal integer constant consist of any combination of any combination of digit from 0 through 7, with a leading 0.Example of octal integer are:038 0 0564 06891
* Hexadecimal integer
A sequence of digit preceeded by 0x or 0x is considered as hexadecimal integer.In that include alphabets A through F or a through f.Example of hexadecimal integer is0x2 0x9F 0xbcd 0x
Example of Java Constant
class IntConstant
{
public static void main(string args[])
{
int i=10;
System.out.println("Integer Contant Values : " +i);
}
}
Output of a Programme
Integer Contant Values : 10
* Decimal Integer
Decimal integer consist of set of digit, 0 through 9. Example of decimal integer constants are: 156 -321 0 45689
Note : Embeded spaces, commas, and non-digit character are not permited between digits.
# Octal Integers
An octal integer constant consist of any combination of any combination of digit from 0 through 7, with a leading 0.Example of octal integer are:038 0 0564 06891
* Hexadecimal integer
A sequence of digit preceeded by 0x or 0x is considered as hexadecimal integer.In that include alphabets A through F or a through f.Example of hexadecimal integer is0x2 0x9F 0xbcd 0x
Example of Java Constant
class IntConstant
{
public static void main(string args[])
{
int i=10;
System.out.println("Integer Contant Values : " +i);
}
}
Output of a Programme
Integer Contant Values : 10
Thanks for sharing, nice post! Post really provide useful information.
ReplyDeleteFor best astrology services contact us Vashikaran Astrologer in Yadgir