<

# Java Operators Tutorial

• Unary Operator
• Arithmetic Operator
• shift Operator
• Relational Operator
• Bitwise Operator
• Logical Operator
• Ternary Operator and
• Assignment Operator

## Unary Operator Example

Unary operator is used to increment, decrement or negate a value.

```
class Operatorex{
public static void main(String args[]){
int x=50;
System.out.println(x++);
System.out.println(++x);
System.out.println(x--);
System.out.println(--x);
}}
```

OUTPUT:
```50
52
52<
50
```

## Unary Operator Example 2

```
class Operatorex{
public static void main(String args[]){
int a=50;
int b=60;
System.out.println(a++ + ++a);
System.out.println(b++ + b++);

}}
```

OUTPUT:
```102
101
```

## Java Arithmetic Operator

Used to perform simple arithmetic operations.

```class OperatorExample{
public static void main(String args[]){
int a=50;
int b=10;
System.out.println(a+b);
System.out.println(a-b);
System.out.println(a*b);
System.out.println(a/b);
System.out.println(a%b);
}}
```

OUTPUT:
```60
40
500
5
5
```