`There are operators used for performing Mathematical and Logical operations in Java. They are `*Arithmetic, Assignment, Bitwise, Compound, Increment/decrement, Relational, Ternary, Logical Operator.*

```
class arithmetic
{
void operator()
{
int a=20,b=10; //This is the Data type of Integer
System.out.println("Add "+(a+b)); // plus operator
System.out.println("Diff "+(a-b)); // minus operator
System.out.println("Mul "+(a*b)); // multiplication operator
System.out.println("Div "+(a/b)); // Division Operator
System.out.println("Moduluo "+(a%b)); // Modulos will leave the remainder on dividing two numbers
}
}
class operator
{
public static void main(String ar[])
{
arithmetic a = new arithmetic(); // a is the object created using the new operator representing the class Arithmetic
a.operator(); // a is the object of the class arithmetic
// calling operator method present in the class arithmetic through the object a
}
}
```

`The above code illustrates the arithmetic operation comprising operators [+,-,*,/,%] `

## 0 comments:

## Post a Comment