1. int a = 056; 2. int b = 034; 3. System.out.println(a); 4. System.out.println(b); What will the output be ? . Please explain the convertion from Octal to Decimal . Mail me the reply at firstname.lastname@example.org
Java thinks in unicode. It doesn't matter if you provide input in octal, binary, decimal or what, it will get converted to unicode by java for processing. Output is provided in decimal unless you specifically force it otherwise (like with a string representation of a number in binary). So you really didn't need to ask it to do anything special to get it converted to decimal. That is just the normal handling.
"JavaRanch, where the deer and the Certified play" - David O'Meara
first check those above web sites ^__^* very very good and some simple examples. here is why: a=056, so output is 46 b/c: (8^0*6)+(8^1*5)=(1*6)+(8*5)=6+40=46 b=034, so output is 28 b/c: (8^0*4)+(8^1*3)=(1*4)+(8*3)=4+24=28 hope this help ^__^* good day.
Would you like to try a free sample? Today we are featuring tiny ads: