In my last post, i explained about role of object in oops language. Now, we more elaborate it with some e.g.
I explain it through a e.g. of car.
In car, we have field: its mph and rpm. we have methods: gear, speed,cadence, music system volume.
class Bicycle
gear, speed, cadence , music system volume. 
{
int cadence= 0;
int speed=0;
int music system volume=0;
int gear=1;
void changeCadence(int newValue)
{
Cadence=newValue;
}
void speedUp(int increment)
{
speed=speed+increment;
}
void changeGear(int newValue)
{
gear=newValue;
}
void musicvolumeHigh{ int increment)
{
music volume= music volume+ increment;
}
void printStates()
{
system.out.println("cadence:"+cadence+"speed:"'+speed+"gear:"+gear+"music volume:"+music volume);
}

  1. In oops programming their are mainly few features which are responsible to make the programming stylish and effective.these are as follows:

    1.Data Encapsulation: Hiding internal data from outside world & accessing it only through publicly exposed methods.
    2.Polymorphism: It is used when we make different forms , but with  same name.
    3.Inheritance: It is used to make different classes from other super classes.It is used for extensible and reusable purpose. 
    4.Modularity: It is closely tied with encapsulation i.e. it sis used for the purpose of mapping.
    5.Abstraction: relevant features necessary.
    6.Access Modifier: public, private, default and protected.
    7. Non-Access Modifier: sealed, enumerator.

Leave Comment