explain oops concepts with examples?
Answer Posted / vijay
OOPS Concepts are mainly 4
1.Abstraction
2.Encapsulation
3.Inheritance
4.Polymorphisam
Abstraction:- Hidding non-essential features and showing the
essential features
(or)
Hidding unnecessary data from the users details, is called
abstraction.
Real Time example: TV Remote Button
in that number format and power buttons and other buttons
there just we are seeing the buttons, we don't see the
button circuits .i.e buttons circuits and wirings all are
hidden. so i think its good example.
Encapsulation:
Writing Operations and methods stored in a single
class. This is Called Encapsulation
Real Time Example: Medical Capsuals
i.e one drug is stored in buttom layer and another drug is
stored in Upper layer these two layers are combined in
single capsual.
Inheritance:
The New Class is Existing from Old Class, i.e SubClass is
Existing from Super Class.
Real Time Example:
Father and Son Relationship
Polymorphism:
Sinle Form behaving differently in different
Situations.
Example:-
Person
Person in Home act is husband/son,
in Office acts Employer.
in Public Good Citizen.
| Is This Answer Correct ? | 101 Yes | 10 No |
Post New Answer View All Answers
Can we create our own daemon thread?
What is the base class of all classes?
Is null a keyword in java?
What is the use of object and class classes?
In which order the iterator iterates over collection?
Write a code to show a static variable?
Can you instantiate the math class?
What are the main concepts of oops in java?
Explain different ways of creating a thread. Which one would you prefer and why?
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 is the Scope of Static Variable?
Is 9 a prime number?
How static variable work in java?
How is string immutable in java?
Can I override protected method in java?