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 purpose of the main method?

544


How can we create a synchronized collection from given collection?

585


Explain the usage of this with constructors?

530


Why main method is static in java?

596


What is java volatile?

545






What is dot operator?

574


Is java jre still free?

533


Why constructor has no return type?

638


What is the size of int in 64-bit jvm?

552


What isan abstract class and when do you use it?

847


What is a java applet? What is an interface?

635


What is the use of private static?

535


Is java ee a framework?

520


What is foreach loop in java?

534


can I implement my own start() method? : Java thread

552