Java is basically a programming language which is used to develop application software. To understand any language, it is always must to know the reason behind its creation, the forces that shaped it, and the feature it inherits.

Java is a mixture of the best elements of its rich heritage combined with innovative concepts required by its mission.

Need for Java

Computer languages innovation and development occurs mainly for two reasons:

  • To quickly adapt to changing environment and its uses.
  • To innovate and refine the improvements in the art of programming

The Java was developed and driven by nearly both these reasons in same proportion.

Java Overview

Overview

Object Oriented Programming is like a heart to Java. In fact, we can say that all Java programs are extracted from object-oriented to some extent.

It is very important to understand the basic principle behind OOP–

Encapsulation –

It is the mechanism that joins/binds together all the code and the data that manipulates and also provides security from the external interference and misuse.

This feature provides a protective wrapper which keeps a check and prevents the code as well as data from being arbitrarily accessed by other code defined outside the wrapper. It can be more understood by the example, think of your refrigerator at home.

The refrigerator cools the items present inside it but there is special place which is wrapped with another door that is used to freeze the ice. Think of that another door as encapsulation process from the other items inside a refrigerator.

Similarly, in Java encapsulation provides the binding as well as wrapping up of data for security purpose as well.

Recommended Post   Using Objects as Parameters

Inheritance –

Another OOP principle is Inheritance. It is the process by which one object acquires the properties of another object. It is important because of the fact that it supports the idea of hierarchical classification.

This can be understood more by example, think of German shepherd which is a part of the classification dog, which in turn is a part of the mammal class, which is under the larger class animal.

If we would not have used the hierarchical manner, then we would have to define each object’s characteristics explicitly. This is the beauty of inheritance.

Polymorphism –

It is a feature of java that allows general class of actions with only one interface. In simple words we can say that it is the feature of java in which we can use one name for multiple methods (function). It is the compiler’s job to select the specific action as it applies to which situation.

 

A First Simple Program –

Now, since we have understood the basic about object oriented programming of Java, let’s do some actual programs.

Following is a simple Java program –

Program

 

/* This is a simple Java program

Call this file “Demo.java”

*/

 

Class Demo {

// This program begins by a call to main() .

 

Public static void main(String args[]) {

System.out.prontln(“Hello World and Welcome to Java Program”) ;

}

}

 

Output –

Hello World and Welcome to Java Program

LEAVE A REPLY

Please enter your comment!
Please enter your name here