OOPs:
Encapsulation–>Protects our data from outside access(Atm)
Inheritance–>Through inheritance,code can be used in multiple places
Polymorphism–>helps in designing flexible and scalable applications
Abstraction–>hiding complex details and showing only the necessary parts
class Father//Base class
{
void house()
{
System.out.println(“Have own 2bhk house”);
}
}
class Son extends Father// Derived class
{
void car()
{
System.out.println(“Have own audi car..”);
}
}
class Single
{
public static void main(String args[])
{
- Son o=new S
- n();
o.car();
o.house();
}
}