Unary operators in Java

Unary operators in Java :


Unary operators : One value effects in one way greater.

Types of Unary operator :They are two types of  Unary operators in Java .
  • Increment ++,
  • Decrement --

Unary operators usage in two types - PRE and POST.

POST usage of U nary operator :
When ever your are using POST increment,It will not effect to that usage.If you want to reflect the value ,it  use again or use another time,Ex: here i ++ + i .In Java left to right is operation of increment or decrement is done .In C language right to left is done.

Pre usage of U nary operator:
Where ever the pre U nary operator is applied there itself change is effecting .The variable cannot have more than one value the single statement,(it cannot hold two values).Ex: i = ++ i here  two values are present then variable use a temporary variable at for initial value. Initially i value is 0.Because of POST operation K value is send to i on left hand side.Here k is a temporary variable .