Sunday, February 22, 2009

example Source code to show the octa,hexa decimal notations



/* example Source code to show the octa,hexa decimal notations
Int x=10 ------------> Decimal
Int x=010 ------------>Octa
Int x=0X10 -------------->Hexa
*/

package literals;

public class OctalHexLiterals {


public static void main(String[] args) {

int i = 10;
int j=010; //here prefix with with zero
int k=0X10; // here prefix with 0 and X or x.
System.out.println( i+"..."+j+"..."+k);

}

}
output:
10...8...16


0 comments:

Post a Comment