Logical And Operator Example Java Program

Definition

Logical conjunction is an operation on two logical values, typically the values of two propositions, that produces a value of true if and only if both of its operands are true. The conjunctive identity is 1, which is to say that AND-ing an expression with 1 will never change the value of the expression. In keeping with the concept of vacuous truth, when conjunction is defined as an operator or function of arbitrary arity, the empty conjunction (AND-ing over an empty set of operands) is often defined as having the result 1.

Logical And Operator Example Program

class LogicalAndOperator{
	public static void main(String[] args){
		int num1,num2;
		num1=43;
		num2=30;
		System.out.println("Input numbers are num1=43 and num2=30");
		if(num1==43&&num2==30){
			System.out.println("Both num1 and num2 satisfy the condition");
		}
	}
}

Sample Output

Output is:
Input numbers are num1=43 and num2=30
Both num1 and num2 satisfy the condition