OOP Java Chapter One
OOP Java Chapter One
Mattu University
College of Engineering & Technology
Unstructured programming
break the problem into several pieces and work on each piece
separately;
to solve each piece, treat it as a new problem which can itself be
broken down into smaller problems;
Abstraction
Encapsulation
Inheritance
polymorphism
They make it possible to reuse code without creating security risks or making a
Abstraction
o Abstraction aims to hide complexity from the users and show them only the
relevant information.
o For example, if you want to drive a car, you don’t need to know about its
internal workings.
private and providing public getter and setter methods to each of them.
o Each field has a getter and setter method Getter methods return
the field
o Setter methods let us change the value of the field.
Polymorphism
Polymorphism to the ability to perform a certain action in
different ways.
In Java, polymorphism can take two forms: method overloading
9
and method overriding.
Engineering and Technology College Mattu
Rift University
Valley University
Polymorphism in Java
object.
they are of their own type and instances of the Object class).
10
o Multilevel inheritance is allowed in Java (a child class can have its own
child class as well).
o Multiple inheritances are not allowed in Java (a class can’t extend more
than one class).. 11
14
<classname>.class
16
17
18