Arithmetic Operators
1.If we are applying any arithmetic operators between two variables a and b, then the result type always will be max(int, type of a type of b).In java, every arithmetic operator returns minimum type is the int type.let's understand more about this by the following table.
![]() | |||
javabychetan.com |
example 1:-
System.out.println('a'+'b');
output is =195
hint :-(a=>97 ,b=>98 unicode values)
example 2:-
System.out.println('a'+0.16)
output is => 97+0.16 => 97.16
2.Infinite Role:
- In integral data types(byte, short, int, long) doesn't have any representation for infinity.if we are applying then we won't get any compile time errors but while running the program we will get RuntimeException saying"ArithmeticExceptionDevide by Zero".