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

COMPUTER SOFTWARE APPLICATION - CITS



           boolean logicalAnd = p && q;

           boolean logicalOr = p || q;
           boolean logicalNot = !p;
           System.out.println(“\nLogical Operators:”);
           System.out.println(“Logical AND: “ + logicalAnd);
           System.out.println(“Logical OR: “ + logicalOr);
           System.out.println(“Logical NOT: “ + logicalNot);


           // Increment and Decrement operators

           int count = 5; count++; // Increment by 1
           int anotherCount = 10;
           anotherCount--; // Decrement by 1
           System.out.println(“\nIncrement/Decrement Operators:”);
           System.out.println(“count after increment: “ + count);
           System.out.println(“anotherCount after decrement: “ + anotherCount);

              }
           }
           Output
           Arithmetic Operators
           Sum: 15
           Difference: 5
           Product: 50
           Quotient: 2
           Remainder: 0


           Assignment Operators
           x after assignment: 8


           Relational Operators
           Is equal: false

           Is not equal: true
           Is greater: false
           Is less: true
           Logical Operators:
           Logical AND: false
           Logical OR: true
           Logical NOT: false
           Increment/Decrement Operators

           count after increment: 6
           anotherCount after decrement: 9




                                                           306

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