oops

13
Page 1 OOPS Concepts in Java By Rohit Mundra Varun Kumar Santosh Dora Shiva krishna Murali krishnan

Upload: er-varun-kumar

Post on 24-Jun-2015

190 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Oops

Page 1

OOPS Concepts in Java

By Rohit Mundra Varun Kumar Santosh Dora Shiva krishna Murali krishnan

Page 2: Oops

Page 2

OOP "Object-Oriented Programming” refers to a programming methodology based on objects, instead of just functions and procedures.

1)  Class2)   Object3)    Abstraction4)    Encapsulation5)    Inheritance6)    Polymorphism 

Page 3: Oops

Page 3

Types of Inheritance

There are 5 types of inheritance as shown below.

1.Single Inheritance2.Multilevel Inheritance3.Multiple Inheritance4.Hierarchical Inheritance5.Hybrid Inheritance

Page 4: Oops

Page 4

Single Inheritance

Page 5: Oops

Page 5

Example of Single Inheritance

Page 6: Oops

Page 6

Multilevel Inheritance

Page 7: Oops

Page 7

Example of Multilevel Inheritance

Page 8: Oops

Page 8

Multiple Inheritance

Java supports multiple inheritance partially through interfaces.

Page 9: Oops

Page 9

Hierarchical Inheritance

Page 10: Oops

Page 10

Hybrid Inheritance

Page 11: Oops

Page 11

• Encapsulation is the technique of making the fields in a class private and providing access to the fields via public methods. If a field is declared private, it cannot be accessed by anyone outside the class, thereby hiding the fields within the class. For this reason, encapsulation is also referred to as data hiding.

Encapsulation Inheritance

Page 12: Oops

Page 12

Encapsulation Program

Page 13: Oops

Page 13