Q:

oops concept

OOP is a programming language model organized around
object rather than actions (logic and functions);
In other words, OOP mainly focuses on the objects that are
required to be manipulated instead of logic. This approach is
ideal for the programs large and complex codes and needs to
be actively updated or maintained.
- It makes development and maintenance easier
- It provides data hiding
- It provides ability to simulate real-world

OOP language follow 4 principles:
1-ENCAPSULATION: We can hide direct access to data by using
private key and we can access private data by using getter and
setter method.
2-ABSTRACTION: It is a process of hiding implementation details
and showing only functionality to the user. Abstraction lets
you focus on what the object does instead of how it does it.

3-INHERITANCE: It is used to define the relationship between two
classes. When a child class acquires all properties and
behaviors of parent class known as inheritance. Child class can
reuse all the codes written in parent class. It provides the code
reusability.

4-: POLYMORPHISM: It is an ability of object to behave in multiple
form. The most common use of polymorphism is Java, when a
parent class reference type of variable is used to refer to a child
class object.
E.g.: WebDriver driver = new ChromeDriver();
We use method overloading and overriding to achieve
Polymorphism.
1
class Person {
 void walk() {
  System.out.println(“Can Run….”);
 }
}
class Employee extends Person {
 void walk() {
  System.out.println(“Running Fast…”);
 }
 public static void main(String arg[]) {
  Person p = new Employee(); //upcasting
  p.walk();
 }
}
1

New to Communities?

Join the community