Page 328 - CA_Blue( J )_Class10
P. 328

13                                        LIBRARY



                                                                                CLASSES















                        Learning Objectives



                   13.1 Primitive and Composite Data Types                     13.2 Class as a Composite Data Type
                   13.3 Difference between Primitive and Composite Data Types   13.4 Introduction to Wrapper Classes
                   13.5 How to use Wrapper Classes?                            13.6 Autoboxing and Unboxing






              Till now, you have created various classes according to your requirement in the previous chapters. As you know, Java
              totally depends on classes and objects. Did you know that Java also provides various predefined classes to do the task
              quickly? Yes, it is true. You don't need to write a code for several tasks. These predefined classes provided by Java are
              known as library classes. These classes are available to use in the form of packages. A package is a collection of similar
              types of classes and sub packages.
              Some of the commonly used packages are as follows:

                                           Java Packages                        Purposes
                                java.lang                          Used for string manipulations
                                java.io                            Used for input/output operations
                                java.util                          Used for input through scanner class
                                Java.math                          Used for mathematical operations
              You already learnt that to use the classes of a package, you need to import the package into your program. To include
              the packages in a program, the import keyword is used. Syntax to import a package is:
                  import <package name>;
              To include the classes of the package java.util, we have to use the following command:

                  import java.util.*;
              Where, * allows you to import all the classes of the java.util package.


                   13.1 PRIMITIVE AND COMPOSITE DATA TYPES
              Primitive data types are in-built data types developed by the developer of the language. They are predefined by the
              Java compiler. A primitive data type stores single value at a time. Java provides eight different primitive data types
              which are byte, short, char, int, float, double, long and boolean. You have already learnt about these data types in the
              previous chapters.



                326326  Touchpad Computer Applications-X
   323   324   325   326   327   328   329   330   331   332   333