Explain various operators used in Java. code example
Example 1: Operators in java
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);
}
}
Example 2: Operators in java
public class JavaUnaryOperator
{
public static void main(String[] args)
{
int a = 23;
System.out.println("Java post-decrement = " + a--);
System.out.println("a = " + a);
System.out.println("Java pre-decrement = " + --a);
}
}