Zeek 36- Introduction to OOPs(Object Oriented Programming)

 

What is OOPs concept in Java ?

Object-oriented programming (OOP) is a way of writing computer programs using "objects" to stand for data and methods. ...

 Because of the way object-oriented programming is designed, it helps the developer by allowing for code to be easily reused by other parts of the program or even by other people.


Why is OOP used?

Image result for What is OOPs in java
Object-oriented programming aims to implement real-world entities like inheritance, hiding, polymorphism etc in programming
The main aim of OOP is to bind together the data and the functions that operate on them so that no other part of the code can access this data except that function.
What is an object in Java?
Any entity that has state and behavior is known as an object. For example, a chair, pen, table, keyboard, bike, etc. It can be physical or logical.
Example: A dog(Object)  has states(Attributes) like color, name, breed, etc. as well as behaviors(Method) like wagging the tail, barking, eating, etc.
What is a class in Java?
Collection of objects is called class.
A class can also be defined as a blueprint from which you can create an individual object
Class doesn't consume any space
Advantage of OOPs over Procedure-oriented programming language

1) OOPs makes development and maintenance easier,
 whereas, in a procedure-oriented programming language,
 it is not easy to manage if code grows as project size increases.

2) OOPs provides data hiding, 
whereas, in a procedure-oriented programming language, global data can be accessed from anywhere.

How to model a problem in OOP?

We identify following


Noun...........................Class...................................................Employee,
Adjective...................Attributes..........................................name,age,salary,etc
Verbs..........................Methods............................................getSalary(),Increment()









Comments

Popular posts from this blog

Zeek_31_MethodInJava.java