Page 317 - CITS - Computer Software Application -TT
P. 317

COMPUTER SOFTWARE APPLICATION - CITS



           boolean result2 = isTrue || isFalse; // true
           boolean result3 = !isTrue; // false

           Increment and Decrement Operators
           •  ++ (Increment): Increases the value of the operand by 1.
           •  -- (Decrement): Decreases the value of the operand by 1.
           Example:1
           int count = 5;
           count++; // count is now 6

           count--; // count is now 5
           Example:2
           int j = 0, k = 0;  // Initially both j and k are 0
           j = ++k;  // Final values of both j and k are 1

           Example:3
           int i = 0, k = 0;      // Initially both i and k are 0
           i = k++;             // Final value of i is 0 and k is

























































                                                           304

                              CITS : IT&ITES - Computer Software Application - Lesson 78 - 84
   312   313   314   315   316   317   318   319   320   321   322