i can't understand how 010|4=12
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   kissan_Das
Posted On:   Monday, July 16, 2007 02:42 AM

class abc
{
public static void main(String args[])
{
System.out.println(010|4);
}
}

out put of the progam is 12.
How is it 12?
i cant't understand this.

Re: i can't understand how 010|4=12

Posted By:   WarnerJan_Veldhuis  
Posted On:   Monday, July 16, 2007 06:53 AM

010 = octal notation = 8 decimal = 00001000 binary

4 = 4 decimal = 00000100 binary

| = binary or operator, ie, add all bits



00001000

00000100|

--------

00001100



00001100 binary = 12 decimal
About | Sitemap | Contact