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
Which collection is ordered in java?
how a programmer confirms that the data submitted has been succesfully inserted into the database(either oracle or my sql).. How a programmer confirm if there is any problem with the program he wrote for insertion... ANS:--- >executeupdate method is having boolean return type, if anything goes wrong in data insertion or data updation, it would return false. otherwise, if it successfully inserts data into the database, it would return true NOW HOW TO I CHECK IN MY DURING EXECUTION WHETHER IT RETURNS TRUE OR FALSE... WELL IT WILL DISPLAY ANY MESSAGE OR NOT
What are latest features introduced with java 8?
What is java lang object?
Which language is java?
Can we pass a primitive type by reference in java? How
Give me an example of array and linked list? Where they can be used?
Can a class be declared as protected?
What is a classloader in java?
Explain the difference between jvm and jre?
What is the difference between array and array list in java?
What is type inference in java8?
What is local class in java?
How can we pass argument to a function by reference instead of pass by value?
What is the major drawback of internal iteration over external iteration?