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
Is linked list a linear or non-linear data structure?
Explain the difference between an Interface and an Abstract class?
What is the difference between jdk, jre, and jvm?
What is ternary operator in java?
What are format specifiers in java?
How many types of parsers are there?
How to convert string to char and vice versa?
Explain different states of a thread in java?
How is garbage collection controlled?
how to create multithreaded program? Explain different ways of using thread? When a thread is created and started, what is its initial state? Or extending thread class or implementing runnable interface. Which is better? : Java thread
Is string serializable in java?
What is a copy constructor in java?
Can we convert stringbuffer to string?
Distinguish between a predicate and a function?
What is the point of polymorphism java?