Java OOPS – Part 1 – Intro to OOPs class object constructor member variables

Object Oriented Programming –

It is a methodology to design a Program and also provides below below concepts to simplify the software development and their maintenance.

Before moving to actual OOP concepts, we need to understand few terms, so let’s discuss one by one

For detailed information of this blog, watch this video –


A class is an outline or a blueprint from which objects are created.

Example – Class Student


Object is actual entity which have state(variables) and behavior(methods).

Example –

State – RollNo, Name etc…

Behavior – DispRoll(), SetRoll(), etc…

Member variables

  • Local variable – if declared inside a method
  • Instance variable – Inside class, but outside method (accessed by object)
  • Class/static variable – Inside class, but outside method (accessed by ClassName)

Methods / Functions

Keyword “new” – to create an object

Constructor – method name same as class name

  • Default
  • Parameterized

Keyword “this” – if local and instance variable is same name

Code samples

Parameterised constructor

Method with return


Content posted is based on learning or working experience,
Share the post with others if find useful,
Any queries?, leave comments or discuss on our, Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *