and operator in if statement java code example
Example 1: condition operator in java
b = (a == 1) ? 20: 30;
Example 2: if and in java
if(x == 1 && y == 2){
println("x = 1 and y = 2");
}
b = (a == 1) ? 20: 30;
if(x == 1 && y == 2){
println("x = 1 and y = 2");
}