Read Java Interview Questions and Answers for Beginners and Experienced

Java AND operator Example

In this Java examples series of Java tutorial, we will study about Java AND operator examples Its also called Java logical AND operator and will see what is the AND logical operators in Java and how java AND operator works.


AND Logical Operator

AND logical operator is used to evaluate whether both statements are true or false. AND operator returns true if both the statements are true, if any statement is false, it will returns false.


Syntax of AND operator

Syntax of AND operator is



Java logical AND operator example

let’s understand the functionality of && operator with an example.

public class JavaExamples {

public static void main(String[] args) {
//Java AND logical operator Example in Java by
int a = 10;
int b = 20;
int c = 30;

System.out.println((a<b) && (c>b));
System.out.println((a>b) && (c>b));






In above Java AND operator example, There are two statements

In first statement: a is less than b which is true AND c is greater than b which is true means both conditions are true that’s why when AND logical operator was applied over them, it gives result as true.

In second statement a is greater than b which is false AND  and c is greater than b which is true, so combination of true AND false is false, that’s why end result is false.

In AND operator in Java, if any result is false, then end result will also be false.