This is my 2nd Session for JAVA
This time we will talk about the most imporatant thing for all programming language
is(OOP) Object Oriented Progamming
The OOP approach acheive 3 concepts
1-Encapslution
2-Inheritance
3-Polymorphism
we will explain each one , we begin by the 1St
1-Encapslution:
the Data is capsluted in one thing called Object and acheive two things are
*Modularity(قائم بذاتة)
the data is collecting in one capsolue (each object has its own properties )
ex: class Demo{
public String name;
float cost;
}
*Data hiding :
(prevent some one from using some properties) & this is done by make some
of ur properties is Private and this is useful for more secure
ex: class Demo{
private String name;
}
2- Inheritance:
the benefits of inheritance *reduce code *data generalization
there are two class one is called Super class(parent) and other is called Sub class (child)
the parent class contain all common properties
the inheritance make by extends keyword
ex: class Parent{
String title;
String name;
}
class Child extends Parent{
int id;
}
3-Polymorphism:
(تعدد الاشكال لشئ واحد)(صلصال)
used with inheritance
ex: OverRide
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment