No this is OOPS concepts;
1) Abstraction
abstraction hiding implementations details and only showing functionality.
interface one{
void start();
// Focus on “what” not “how”
}
2) Encapsulation
a wrapper which creates the object of the class with private variables but public getters/setters.
class Student {
private int age;
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
}
3) Polymorphism
Two Types
- 1 compile time (it overloads the methods)
int add(int a, int b)
double add(double a, double b)
- 2 runtime (it overriders the method)
class Animal {
void sound() {
System.out.println("Barking")}
}
class Dog extends Animal {
void sound() {
System.out.println("Bark");
}
}
4) Inheritance
easy its just in the word it inherit...Hierarchy
class Animal {
void eat() {}
}
class Dog extends Animal {
void bark() {}
}
Top comments (0)