In the previous posts we have learned about the Characeteristics of Java (Refer here).One of the characteristics are Java is  Object Oriented Programming(OOP's) Language.


Now before we take a dive into Java language we have to know the basic OOP's.



  • Object Oriented Programming is the technique to create programs based on the real time entities like objects and data.We can summarize it as the way of real world modeling.
  • Unlike procedural programming here the programs are constructed around objects and data.
  • Objects are the basic real world runtime entites which have certain behaviour,properties,type,and identity.
Fundamentals of OOP

Before understanding Java we must understand OOP and its basic features.They are: 
  • Class is the central point of OOP and it is collection of objects and data and methods exhibiting certain kind of behaviour.In the classname every word must start with a "capital letter" Ex: HelloWorldJava.
        Example: public class Box{
                                  // your code here
                                  /* This is a basic class with data and methods.
                      private int a;
                      private int b;
                      public void setValue(int width){
                             a = width;
                      }
                      public void setValue(int length){
                             b = length;
                        }
                      public void displayValues(){
                               System.out.println(" width is " + a " length is " + b);
                       }
                         }
  • Objects are the basic unit of OOP and basic runtime entities expressed as variables and methods.
  • Methods in Java determine the behaviour of the object.The methodName must start with a ''lowercase letter'' and the preceeding word in the method name must be a "capital letter".
         Example : public void displayValues(){ 
                        //your code here.
                        }
  • Abstraction is the process of hiding the unnecessary or secret details and exposing the essential features of an object.This concept is mainly used by classes.The above image shows the abstraction of a Car class which hides the unnecesarry details and exposes the details like Change gears,Brake,Change cadence.
  • Encapsulation is the ability of an object to bind the data and methods together.The Accessor and Mutator methods exhibit encapsulation.The above image also demonstrates the Encapsulation process.
  • Data Hiding is the ability of the objects to shield the variables from external access.
  • Polymorphism.Let us make this straight.Polymorphism is the ability of an object to take one or more forms.
         Polymorphism can be achieved by Overloading(method and operator) and Overriding( method).

   Using the above diagram we can explain the concept easily.Here we have an Animal object which is classified into Dog,Duck,Cat which have different behaviours like doWoof for Dog,doQuack for Duck,doMeow for Cat.This will be explained in later posts in detai.
  • Inheritance is the capability of a class to use properties of other classes by extending its features.The main idea behind the Inheritance is the code reusability.i.e. If I declare an Animal object it has methods like animalName(),animalSound().

        If I want to write code for a Dog object then instead of writing all methods I can simply use the above code and methods by simply extending the Animal Class.This is known as Inheritance.

These are the basic fundamentals of the OOPs.

I found a nice video on YouTube on OOPs and here it is :



In the next posts we will dive into the Java Language Basics.Stay Tuned and Au Revoir!!