what are the oops concept in java explain with real time
examples

Answer Posted / suresh

oops concepts are mainly 3
1.encapsulation
2.inheritance
3.polymorphism

1 :- encapsulation refers to binding the data in a single
class the data present inside the encapsulation is secured.

abstraction comes under encapsulaton.

real time example:-if you get fever you will take the
medicine to cure.the medicine is the capsule in which the
powder is present.the powder is a mixture of several
chemicals as in the same way all the classes are mixed and
only the output(object) you will see as if a capsule.

2 :- inheritance is nothing but extending the class from
parent to the child

real time example:- the prime minister of india
(late)mr.jawaharlal nehru and his daughter indira gandhi
and her son rajiv gandhi and his wife sonia gandhi.

3 :- polymorphism refers to which it does many things

real time example:- consider the electric power which does
many things .

Is This Answer Correct ?    28 Yes 49 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between assignment and initialization?

547


Explain the importance of import keyword in java?

517


Explain the advantages of packages in java?

513


What about abstract classes in java?

603


Which non-unicode letter characters may be used as the first character of an identifier?

589






How to compare strings in java?

497


Name few java.lang classes introduced with java 8 ?

531


What is the arraylist in java?

522


What is a parameter used for?

507


What is an example of a boolean?

567


Is it possible to override private or static method in java?

536


What is the purpose of void?

529


Is 64bit faster than 32 bit?

573


How does finally block differ from finalize() method?

578


How many classes can any class inherit java?

504