Introduction To Android Development - OOPS
Introduction To Android Development - OOPS
Part - 1
The core Component in oops is classes
source → package sight click → New Java class
class: keyword to make class
Class represent a object
for the class we need to make instance
Syntax: Class_Name obj_Name = new Class_Name()
we can access the properties of that class by obj_Name.
Main class
Another class:
We can access the class ‘Phone’ by creating a object for the class.
method
↳ method have name,
↳ every Method have a name
↳ There is inputs in method
↳ void: no return.
↳ Method is used to reuse and organizing the code
↳ Private: using private method only the class can access no outside
class can access the method.
↳ Access modifiers,
public: accessible to all class.
private: only accessible by inside a class. Private use only inside of
the classes. Not given for class.
Protected
↳ If we want to change
↳ If we want to get
use in main
by deleting the caper keyword you Can completely change the behavior of
The method.
We can give same method with different parameters
while we constructing a class extends dog the dog's parent class. will be
inherited
Polymorphism
If we have another contractor in class it is called polymorphism -> having
multiple forms.
Before, The eat method behave Differently it is another kind of
Polymorphism.
same method with different input arguments.
Part – 3 (composition)
In package create a new class Engine
we can use it as a type
Engine use in main
1.
2.
Keywords
↳ final :The value won't change we cannot change value.
↳null
Challenge
Q. Doctor consultation application as the given model.
Sol: