SUBJECT MATERIAL, EBOOKS, IMPORTANT QUESTION , ASSIGNMENT QUESTION, OLD QUESTION PAPER

Thursday 10 August 2017

Increment & Decrements Operators

Increment and Decrement Operator in Java : It is one of the variation of “ Arithmetic Operator “. Increment and Decrement Operators are... thumbnail 1 summary

Increment and Decrement Operator in Java :

  1. It is one of the variation of “Arithmetic Operator“.
  2. Increment and Decrement Operators are Unary Operators.
  3. Unary Operator Operates on One Operand.
  4. Increment Operator is Used to Increment Value Stored inside Variable on which it is operating.
  5. Decrement Operator is used to decrement value of Variable by 1 (default).

Types of Increment and Decrement Operator :

  1. Pre Increment / Pre Decrement Operator
  2. Post Increment / Post Decrement Operator

Pre-Increment Operator :

  1. “++” / “--” is written before Variable name.
  2. Value is Incremented First and then incremented value is used in expression.
  3. “++” / “--” cannot be used over “Constant” of “final Variable“.

Post-Increment Operator :

  1. “++” / “--” is written after Variable name.
  2. num1++ will increment value inside “num1” variable after assigning old value to itself.
  3. New Value of num1 = 2.
  4. “++” / “--” cannot be used over “Constant” of “final Variable“.