Logical operator

Example of Logical operator AND and OR

package basic;

public class Logicaloperator {
	 
	public static void main(String[] args) 
	
	{
		System.out.println(12&12);
		
		System.out.println(11&12);
		
		System.out.println(010|4);
		//010 is a octal number
		// 4 2 1    4 2 1            1000
		// 0 0 1    0 0 0            0100 //binary number of 4
		//                         = 1100   so ans=12
		
	}
}

output:
12
8
12

Leave a Reply