Page 334 - CA_Blue( J )_Class10
P. 334

•  Character.toLowerCase(): This method is used to convert the parameter passed to lowercase letter. It returns a
                  boolean value. Syntax of the toLowerCase() method is:
                  char variable = Character.toLowerCase(char);
                  For example:

                  char b = Character.toLowerCase('A');
                  Output: a

                   13.6 AUTOBOXING AND UNBOXING
              Automatic conversion from primitive data type to its corresponding object class is called autoboxing. In other words, if
              a primitive data type value is automatically converted into its wrapper class type, then it is called autoboxing.
              Syntax:
                  WrapperClass wrapperObject = primitiveValue;
              Example:
                  // Autoboxing int to Integer
                  Integer intObject = 100;
                  // Autoboxing double to Double
                  Double doubleObject = 15.5;
              Automatic conversion from object of wrapper class to its primitive data type is called Unboxing. In other words, if an
              object of a wrapper class is automatically converted into its primitive data type, then it is called unboxing.
              Syntax:

                  primitiveType primitiveVar = wrapperObject;
                  // Autoboxing of int to Integer
                  Integer wrapperInteger = 100;
                  // Unboxing: Converting Integer object to int primitive
                  // Unboxing happens here
                  int primitiveInt = wrapperInteger;
              Let us take an example:

                  public class BoxingUnboxingExample {
                      public static void main(String[] args) {
                          // Autoboxing: primitive to Wrapper Object
                          int primitiveInt = 50;
                          // Boxing happens here
                          Integer wrapperInt = primitiveInt; System.out.println("Autoboxing (Boxing):");
                          System.out.println("Primitive int: " + primitiveInt);
                          System.out.println("Wrapper Integer: " + wrapperInt);
                          // Unboxing: Wrapper Object to primitive
                          Integer anotherWrapperInt = 100;
                          // Unboxing happens here
                          int anotherPrimitiveInt = anotherWrapperInt;
                          System.out.println("\nUnboxing:");
                          System.out.println("Wrapper Integer: " + anotherWrapperInt);
                          System.out.println("Primitive int: "+ primitiveInt);
                  }
                  }
              You will get the following output:











                332332  Touchpad Computer Applications-X
   329   330   331   332   333   334   335   336   337   338   339