A hexadecimal constant starts with a leading zero-x, (0x or 0X).
The range of a hexadecimal digit is 0 to 15, so A through F (or a through f ) are substituted for 10 through 15.
In the following example, we define an integer with hexadecimal integer literal.
public class Main{
public static void main(String[] argv){
int f = 0XFFFFF;
System.out.println(f);
}
}
The code above prints out the following:
1048575
java2s.com | Contact Us | Privacy Policy |
Copyright 2009 - 12 Demo Source and Support. All rights reserved. |
All other trademarks are property of their respective owners. |