Page 88 - computer science (868) class 11
P. 88

04


                                                                                    OBJECTS

















                      Learning Objectives


                  4.1  Object                                       4.2  Class
                  4.3  Basic Concept of a Virtual Machine           4.4  Basic Input/Output Using Scanner Class from JDK
                  4.5  Basic Concept of an Exception




              In the previous chapter, we have read about object-oriented programming and its basic principles. Object-oriented
              programming has two basic components. They are known as “objects” and “classes”. In this chapter, we will deal with
              these components in detail.


                  4.1 OBJECT
              Is there anything in the world that is not an object or not associated with an object? The answer is “NO”. Anything
              we can imagine in the world is an object. Every object has an entity that has a state, behaviour, and events. The
              properties which are associated with an object at any given time contain data. This is called a state. The functionality
              that an object is supposed to perform is called “behaviour”. Whenever the value of the object changes, it raises
              events.

              Suppose, we consider a fan as a real-world object.

              The properties/characteristics of the object can be:
              1.  Number of blades (2/3/4)
              2.  The manufacturing company
              3.  The speed of the fan

              The behaviour of the object can be:
              1.  Switched on/off
              2.  The speed of the fan should be passed as data by revolving the regulator.
              The event can be:
              When the fan revolves, it delivers air. This can be expressed as an event.

              Thus, an object is a unique entity that contains properties, methods, and events in an object-oriented programming
              language.
              Let us take another real-life object, a well-known vegetable “radish”.




                8686  Touchpad Computer Science-XI
   83   84   85   86   87   88   89   90   91   92   93