Java : Programming Language

Class:

Class is a specification to capture attributes or properties and behaviour of a specific type of objects in a categorised manner. Say Human is a type of specimen and it has some properties like number of legs, number of eyes, height, weight, hair colour etc etc. Also it has some behaviour like it can walk, it can run, it eats, it sleeps, it speaks etc etc. So when we have to draw a guidelines to say a specific object belongs to Human class then we categorically list down all the behaviour and properties which we can identify for sure and say that this object is human. This listed down properties and behaviours are grouped together and given a name which is known as class name.

Object:

An object is a instance of class. Likewise in our previous example, lets say a document is created and in that every possible behaviour and properties are listed to identify a human is class definition while a person is a real object.

We create class definition, which is a blueprint while when we instantiate it, we create an object.

Encapsulation:

Encapsulation as literal meaning to safeguard something from danger/destruction, in object oriented programming, it's the feature of programming language which provides the mechanism to restrict the exposure of data only to intended use. In Java we have public, private and protected keywords to provide security of data and methods in a class.

  • Public: Full access,
  • Protected: Within a package access
  • Private: Within a class access

Inheritance:

As inheritance means to acquire properties of parents, grandparents and ancestors, in java we have this facility where a class can inherit methods and data of a parent or superclass based on accessibility provided.

Abstraction:

Abstraction is a technique followed in object oriented programming where we try to hide the complexities behind the implementation of various entities and expose certain APIs [Application Programming Interface] to communicating entities. Using encapsulation we secure the data as well as we hide the properties and methods which are not needed from outside. This is one aspect of abstraction while there is another aspect which is again called as generalised abstraction.

Polymorphism: