Skip to content

Latest commit

 

History

History

36.Introduction_To_OOPS

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Java Tutorial: Introduction to Object Oriented Programming

  • Object-Oriented Programming tries to map code instructions with real-world, making the code short and easier to understand.
  • With the help of OOPs, we try to implement real-world entities such as object, inheritance, abstraction, etc.
  • OOPs helps us to follow the DRY(Don't Repeat Yourself) approach of programming, which in turn increases the reusability of the code.

Two most important aspects of OOPs - Classes & Objects :

Class :

  • A class is a blueprint for creating objects.
  • Classes do not consume any space in the memory.
  • Objects inherit methods and variables from the class.
  • It is a logical component.

Objects :

  • An object is an instantiation of a class. When a class is defined, a template (info) is defined.
  • Every object has some address, and it occupies some space in the memory.
  • It is a physical entity.
  • Take a look at the below example to get a better understanding of objects and classes :

image

How to model a problem in OOPs

  • We identify the following:
Noun              - Class                        - Employee
Adjective         - Attributes                   - name, age, salary
Verb              - Methods                      - getSalary(), increment()
  • This is all for this tutorial. We will do a detailed discussion on every aspect of OOPs in further tutorials.

Handwritten Notes: Click to Download

Ultimate Java Cheatsheet: Click To Download