Lecture 7 Flashcards
Access Modifier
The restriction to access the class members that are the 1.——- or 2.——-.
- attributes
- methods
public (+) - class, package, subclass, world
protected (#) - class, package, subclass
default () - class, package
private (-) - class
be accessed from == > any class
Whenever you declare attribute in public, any class can access that attribute even they are in the same package, different package and the outside.
Public (+)
be accessed from ==> the same class
==> class in the same package
==> sub-class in the same package.
==> sub-class in the differenct package.
protected (#)
be accessed from ==> the same class
==> class in the same package
==> sub-class in the same package
default()
be accessed from ==> the same class only
private (-)
1.——– is a set of instructions that allows a class or objects to perform a task.
- Method
- What are the THREE types of methods?
- Main method
- Constructor
- Class method
1.——– is protect direct access to class variable, Data hiding, Maintainability and Controllable.
- Encapsulation
2.——- is Resuability, Extensibility, reuse the super class and IS-A relationship.
- Inheritance
3.——– is having multiple forms, Flexibility and having overloading method.
- Polymorphism
What is the OOP Concept?
E-I-P
-Encapsulation
-Inheritance
-Polymorphism
- private attribute
- public getter and setter
E (Encapsulation)
- extends -> class
- implements -> interface
I (Inheritance)
- subclass -> super class
P (Polymorphism)