Page 56 - TP_iPlus_V2.1_Class8
P. 56

•  Polymorphism: Polymorphism allows objects of different classes to be treated as objects of
                     a common superclass. In object-oriented programming, polymorphism allows objects to be
                     treated as instances of their parent class rather than their actual class. This means that a single
                     function or method can operate on different types of objects, making the code more flexible
                     and reusable.

                     Example: As a family car, it’s equipped with extra seats and space for luggage, making it
                     suitable for personal trips. When used as a taxi, it features a fare meter and a taxi sign for
                     transporting passengers. As a pool car for students, it includes extra safety seats and a schedule
                     to manage shared transportation. Despite these different uses, the car remains fundamentally
                     the same, demonstrating how one object can fulfil multiple roles.

                   i +   INTRODUCING BLUEJ

                  Previously, we used simple text editors such as Notepad to develop Java programs. With the
                  advancement in technology, there are different types of Integrated Development Environment
                  (IDE) available free of cost. Some of the IDEs are Netbeans, Eclipse, and BlueJ. In this chapter, we

                  are using BlueJ.
                  BlueJ is an IDE designed for beginners. It has a built-in editor, debugger,
                  and viewer. An editor gives us an area where we can write programs,
                  and a debugger allows us to find errors in the programs. On the other
                  hand, the viewer shows the output of the program.

                  BlueJ is a freely downloadable application. We can download it from
                  https://www.bluej.org/. After downloading the application, we need to
                  install it on our computer.

                   i +   INTERFACE OF BLUEJ

                  After installing the BlueJ IDE, double-click on the BlueJ application shortcut icon on the Desktop.
                  The BlueJ application window appears.

                                Title Bar
                              Menu Bar
                              New Class
                                Button
                               Compile
                                Button

                             Project Icon









                          Object Bench







                    54
                         iPlus (Ver. 2.1)-VIII
   51   52   53   54   55   56   57   58   59   60   61