In this java article, we will be covering AND logical operator in Java. AND logical operator means both condition need to evaluate TRUE.
Lets look to syntax of it in Java.
int x = 1;
int y= 5;
if(x < y & x == 1)
{
System.out.println("x > y and x = 1");
}
else
{
System.out.println("else..");
}
Lets see it in Java code example.
In above example, we declared two variable and used "&" operator as AND operation. If block executes if both condition is TRUE. To test it, we printed both condition IF and ELSE.