Page 43 - CA_Blue( J )_Class9
P. 43

03                 ELEMENTARY CONCEPT OF



                                                                 OBJECTS AND CLASSES















                           Learning Objectives



                     3.1 Concept of Classes and Objects                  3.2 Class in Java
                     3.3 Object in Java                                  3.4 Properties of Class and Object
                     3.5 Difference between Class and Object


                 Two most important concepts of Object-Oriented Programming are classes and objects. Classes are comparable to
                 a category of real-world things and these real-world things are comparable to objects. Let us learn these concepts
                 in detail.


                     3.1 CONCEPT OF CLASSES AND OBJECTS
                 A class consists of characteristics (attributes) and behaviour (methods), which are used to create objects.

                 Let us understand with an example,


                                          Class name: student
                                          attributes: name, stu_type
                                          behaviour: setname () and setstu_type()




















                             Object 1          Object 2             Object 3          Object 4
                             Attributes:       Attributes:          Attributes:       Attributes:
                             name = Aditi      name = Ananya        name = Ajay       name = Reshma
                             stu_type = Primary stu_type = Secondary stu_type = Higher  stu_type = Graduate
                                                                    Secondary


                                                                          Elementary Concept of Objects and Classes  41
   38   39   40   41   42   43   44   45   46   47   48