Page 112 - ComputerScience_Class_11
P. 112

The characteristics of radish are:
              1.  It may be white or pink in colour.
              2.  It is conical in shape.
              The behaviours are:
              1.  It is used to make different recipes.
              2.  It is used in ceremonies to be offered to God as “Prasadam”.
              The event can be:
              It tastes good.
              Now, if we consider a software object:
              In an examination system, the objects are the students of a class. And every student bears
              some characteristics and behaviour.

              The characteristics of the student could be:
              1.  Name of the student                    2.  Class of the student
              3.  Gender                                 4.  Roll number
              The behaviour of the student could be:
              1.  Whether good in studies
              2.  Whether good in extra-curricular activities
              Let us relate a real-world object with a software object.
              1.  The characteristics of the real-world objects are the same as data members of the software objects.
              2.  The behaviour of the real-world objects is the same as the methods of the software objects.

              This relation is represented in the illustration given below:

                                                       Real-World Object (Fan)
                                       Characteristics                             Behaviour
                         1.  Number of blades (2/3/4)              1.  Switched on/off

                         2.  The manufacturing company             2.   Speed of the fan should be passed as data by
                                                                      revolving the regulator.
                         3.  The speed of the fan


                                                      Software Object (Student)

                                       Data Members                                Methods
                         1.  Name of the student                   1.  Whether good in studies
                         2.  Class of the student                  2.   Whether good in Extra-curricular activities
                         3.  Gender
                         4.  Roll number

                  5.2 CLASS
              A class is used to create objects of similar types. This is because each object will contain all the different types of data
              members and methods that are described in the class.
              Classes in Java are non-primitive/user-defined data types that act as a blueprint for creating objects of the same type.
              In other words, they are a set of instructions to build a specific type of object. A class is comprised of characteristics
              and behaviour.



                  110  Touchpad Computer Science (Ver. 3.0)-XI
   107   108   109   110   111   112   113   114   115   116   117