and operator in if condition in 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");
}