java logical operator code example
Example 1: condition operator in java
b = (a == 1) ? 20: 30;
Example 2: Operators in java
// java unary (~) operator
public class JavaUnaryOperator
{
public static void main(String[] args)
{
int a = 8, b = -4;
System.out.println("a = " + a);
System.out.println("b = " + b);
System.out.println(a + " java bitwise complement is = " + ~a);
System.out.println(b + " java bitwise complement ia = " + ~b);
}
}