how to use logical operators in java code example
Example 1: condition operator in java
b = (a == 1) ? 20: 30;
Example 2: Operators in java
public class AssignmentOperatorDemo
{
public static void main(String[] args)
{
int numOne = 60;
int numTwo = 30;
numTwo += numOne;
System.out.println("(+=) : " + numTwo);
numTwo -= numOne;
System.out.println("(-=) : " + numTwo);
numTwo *= numOne;
System.out.println("(*=) : " + numTwo);
numTwo /= numOne;
System.out.println("(/=) : " + numTwo);
numTwo %= numOne;
System.out.println("(%=) : " + numTwo);
}
}