SlideShare une entreprise Scribd logo
1  sur  10
Objectives

On completion of this period, you would be able to
  know :


• JVM
• OOP concepts




                                                     1
OOP Concepts

The OOP Concepts are

• Encapsulation

• Inheritance

• Polymorphism




                        2
Encapsulation

• The wrapping up of data and methods into a single
  unit is known as Encapsulation
• The data is not accessible to the outside world and
  only those methods, which are wrapped in the
  class can access it
• The insulation of the data from direct access by
  the program is called “ Data Hiding”


                                                        3
Inheritance

• Inheritance is the process by which objects of one
  class acquire the properties of objects of another
  class
• Inheritance provides the idea of reusability
• We can add additional features to an existing class
  without modifying it
• The original class is called as base class
• The inherited classes are called as sub classes

                                                    4
Inheritance


                  Shape




Circle           Rectangle      Triangle




         Fig. 4.3 Inheritance



                                           5
Inheritance

• In the Fig. 4.3 Shape is the base class
• Circle, Rectangle and Triangle are classes
  that are inherited




                                            6
Polymorphism


• Polymorphism is another feature of OOP concept

• ‟Poly‟ means „many‟, ‟Morph‟ means „forms‟

• “Polymorphism means the ability to take more
  than one form”




                                                   7
Polymorphism


• Allows     a      method   to    have    multiple
  implementations that are selected based on which
  type of object is passed




                                                      8
Polymorphism
                                 •Current object is circle
                                 • method draw() is called
                  Shape
                  draw()




Circle          Rectangle                   Triangle
draw()           draw()                      draw()




         Fig. 4.4 Polymorphism



                                                             9
Polymorphism
                                 •Current object is Triangle
                                 •Method draw() is called
                  Shape
                  draw()




Circle          Rectangle             Triangle
draw()           draw()                draw()




         Fig. 4.5 Polymorphism



                                                        10

Contenu connexe

Plus de myrajendra

Plus de myrajendra (20)

4 jdbc step1
4 jdbc step14 jdbc step1
4 jdbc step1
 
Dao example
Dao exampleDao example
Dao example
 
Sessionex1
Sessionex1Sessionex1
Sessionex1
 
Internal
InternalInternal
Internal
 
3. elements
3. elements3. elements
3. elements
 
2. attributes
2. attributes2. attributes
2. attributes
 
1 introduction to html
1 introduction to html1 introduction to html
1 introduction to html
 
Headings
HeadingsHeadings
Headings
 
Forms
FormsForms
Forms
 
Css
CssCss
Css
 
Views
ViewsViews
Views
 
Views
ViewsViews
Views
 
Views
ViewsViews
Views
 
Starting jdbc
Starting jdbcStarting jdbc
Starting jdbc
 
Properties
PropertiesProperties
Properties
 
Java.sql package
Java.sql packageJava.sql package
Java.sql package
 
Interface callable statement
Interface callable statementInterface callable statement
Interface callable statement
 
Interface result set
Interface result setInterface result set
Interface result set
 
Interface database metadata
Interface database metadataInterface database metadata
Interface database metadata
 
Interface connection
Interface connectionInterface connection
Interface connection
 

Oops

  • 1. Objectives On completion of this period, you would be able to know : • JVM • OOP concepts 1
  • 2. OOP Concepts The OOP Concepts are • Encapsulation • Inheritance • Polymorphism 2
  • 3. Encapsulation • The wrapping up of data and methods into a single unit is known as Encapsulation • The data is not accessible to the outside world and only those methods, which are wrapped in the class can access it • The insulation of the data from direct access by the program is called “ Data Hiding” 3
  • 4. Inheritance • Inheritance is the process by which objects of one class acquire the properties of objects of another class • Inheritance provides the idea of reusability • We can add additional features to an existing class without modifying it • The original class is called as base class • The inherited classes are called as sub classes 4
  • 5. Inheritance Shape Circle Rectangle Triangle Fig. 4.3 Inheritance 5
  • 6. Inheritance • In the Fig. 4.3 Shape is the base class • Circle, Rectangle and Triangle are classes that are inherited 6
  • 7. Polymorphism • Polymorphism is another feature of OOP concept • ‟Poly‟ means „many‟, ‟Morph‟ means „forms‟ • “Polymorphism means the ability to take more than one form” 7
  • 8. Polymorphism • Allows a method to have multiple implementations that are selected based on which type of object is passed 8
  • 9. Polymorphism •Current object is circle • method draw() is called Shape draw() Circle Rectangle Triangle draw() draw() draw() Fig. 4.4 Polymorphism 9
  • 10. Polymorphism •Current object is Triangle •Method draw() is called Shape draw() Circle Rectangle Triangle draw() draw() draw() Fig. 4.5 Polymorphism 10