2. Disclaimer: This presentation is prepared by trainees of
baabtra as a part of mentoring program. This is not official
document of baabtra –Mentoring Partner
Baabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt .
Ltd
4. Object oriented programming
• is a programming paradigm that represents
concepts as “objects” that have data fields
and associated procedures known as
methods.
• data fields :attributes that describe objects.
• methods : some procedures designed for a
specific task.
5. Object
• which are usually instances of classes, are
used to interact with one another to design
applications and computer programs.
• An object is an instantiation of class. In terms
of variables, a class would be a type, and an
object would be a variable.
6. Class
• A class is an expanded concept of a data
structure: instead of holding only data, it can
hold both data and functions.
e.g. class class_name{
access_specifier_1:
member_1;
access_specifier_2:
member_2;
………………..
}
7. Members of Class
• Private: private members are accessible only
in the class itself.
• Public: public members are accessible outside
the class(anywhere).
• Protected :protected members are accessible
in the same package, and in the subclasses of
the class and inside the class.
9. Encapsulation
• It is the mechanism that binds the data &
function in one form known as class. The data
and function may be private or public.
• Encapsulation guarantees the integrity of the
data contained in the object.
10. Object binds together in the form of a
class..
Animal
Dog Fish
MuttBull StarGold
Cat
11. Inheritance
• Mechanism of deriving a new class from an
already existing class.
• 5 levels of inheritance
-Single level
-Multilevel
-Multiple
-Hierarchical
-Hybrid
12. Types of Inheritance
Base Class
Derived Class
Single level
Multi Level
Flower
Rose India
World
Rajastan
Jaipur
14. Types of Inheritance
• Single level
Class Base{
Data members and Functions;};
Class Derived : Public Base{
Data members and Functions;};
• Multiple
Class A{};
Class B{};
Class C:Public A , Public B{};
15. Types of Inheritance
• Multi Level
Class A{};
Class B: Public A{};
Class C :Public B{};
Class D: Public C{};
18. Polymorphism
• Poly means many. Morphism means forms.
• Polymorphism feature enables classes to
provide different implementation of methods
having the same name.
• Two types of Polymorphism
– Compile time (Overloading)
– Run time(Overriding)
19. Overloading
• Overloading
– In method overloading, a method is executed
depending on the number and type of parameters
passed to it.
– When we compile the class, the compiler binds
the appropriate method to the object based on
the method’s arguments. This is called early
binding and this process is referred to as compile
time polymorphism
20. Overriding
• You can have a method in subclass overrides
the method in its super classes with the same
name and signature. Java virtual machine
determines the proper method to call at the
runtime, not at the compile time.
21. Abstraction
• Abstraction is simplifying complex reality by
modelling classes appropriate to the problem,
and working at the most appropriate level of
inheritance for a given aspect of the problem.
• It deals with the outside view of the object.
22. Abstraction
• Modifiers:
If you want to access a particular variable , method
or class from anywhere , then make that variable
accessible by using public modifier.
If you want to restrict a particular variable , method
or class to be accessible outside the class , use
private modifier.
23. Abstraction v/s Encapsulation
• class person
{
private String name;
public void main()
{
System.out.println(""+name);
}
}
• Abstraction means giving useful information , Encapsulation means hiding
unnecessary information.
24. If this presentation helped you, please visit our
page facebook.com/baabtra and like it.
Thanks in advance.
www.baabtra.com | www.massbaab.com |www.baabte.com