Page 66 - CA_Blue( J )_Class9
P. 66

4      {
                     5          int i = 40;

                     6          float f = 34.8f;
                     7          double d = 560938d;

                     8          String str = "Hello, World!";
                     9          char c = 'a';
                    10          boolean bl = true;

                    11          String n = null;

                    12          System.out.println("Different Types of Literals used in Java");
                    13          System.out.println("----------------------------------------");
                    14          System.out.println("Integer Literal: "+i);

                    15          System.out.println("Float Literal: "+f);
                    16          System.out.println("Double Literal: "+d);

                    17          System.out.println("String Literal: "+str);
                    18          System.out.println("Character Literal: "+c);

                    19          System.out.println("Boolean Literal: "+bl);
                    20          System.out.println("Null Literal: "+n);

                    21      }
                    22  }



                  You will get the following output:



















                  4.4.3 Operators
                  Operators are the special symbols. They are used to perform arithmetical or logical calculations on one or more
                  operands. For example, 2 + 4 = 6 (Here, + and = are operators and 2, 4 are operands.)

                  Some commonly used operators are:
                  Arithmetic Operators   :    +, -, *, /, %           Assignment Operators    :    =, +=, -=, *=, /=, %=
                  Relational Operators   :    >, <, >=, <=, ==, !=    Unary Operators         :    ++, --

                  Logical Operators      :    &&, ||, !               Ternary Operator        :    ?:


                    64    Touchpad Computer Applications-IX
   61   62   63   64   65   66   67   68   69   70   71