Page 94 - CA_Blue( J )_Class9
P. 94

6          System.out.println("Result of Remainder : " + c);
                     7      }

                     8  }

                                  Input:                             You will get the following output:
















                  Unary Plus (+) Operator
                  The unary plus (+) operator is a unary operator that works only on one operand. The output is the same value of
                  the operand which is either of an integer literal or real literal. The result of the unary plus operator may be positive
                  or negative depending on the values. For examples:
                         If i= –10     then,  = +(i) = –10

                         If i= –20.5   then,  = +(i) = –20.5


                   Program 10     Example of Unary plus (+) operator.

                     1  class unaryplus

                     2  {
                     3      public static void main(int a)

                     4      {
                     5          int b=+a;
                     6          System.out.println("Operation of Unary (+) operator on "+a+ " is "+b);

                     7      }

                     8  }

                     Input:                                You will get the following output:




















                    92    Touchpad Computer Applications-IX
   89   90   91   92   93   94   95   96   97   98   99