Introduction to Java Programming

Introduction

JAVA is one of the world's most widely accepted high-level programming language. It was released in 1995 and was developed by Sun Microsystems. The distinction of JAVA grew with time. With the ability to run on various platforms, for example, Windows, Macintosh, Unix, etc. JAVA turned out to be the benchmark in the era of Internet Programming.

The key reason for its worldwide usage and huge success goes to its agility. JAVA has continually adapted the changes in the programming environment and way of programming. This tutorial is designed to give you insight into the basics of JAVA. It comprises data types, operators, control statements, and the introduction of the OOP (Object Oriented Programming) paradigm. It is followed by an introduction to concepts of inheritance, packages, abstract classes, interfaces, exception handling, and multi-threading. This journey of learning will be example oriented to explain the utility and also the practical approach.

History Of JAVA

JAVA was initiated by Green Team, headed by James Gosling( Father Of JAVA ) in the early 1990s. It was designed for interactive television initially and be used as a language for digital devices. There were several principles for creating the JAVA programming language. They are simple, object-oriented, platform-independent, portable, secured, robust, architecture-neutral, interpreted, high performance, multithread, distributed, and dynamic.

The Green Team as mentioned above was a small team with James Gosling, Patrick Naughton, and Mike Sheridan. It was first called Greentalk (extension .gt) coined by the father himself.

Later it was named Oak and developed as a part of the Green Project.

Finally, in 1995, It was named JAVA due to the trademark issue of the name Oak by Oak Technologies.

Object-Oriented Programming

The core of JAVA lies with Object-oriented programming (OOP). All Java programs are to a certain extent are object-oriented. Before exploring more of the JAVA, let us understand what Object Oriented Programming actually is. 

There are two basic elements of programming: code and data. The program can be done organized around the code or around the data. We can better understand it as a program written around what is happening, and others around who is affected.

The first approach frames the program linearly as a series of steps. This is a process-oriented model. Example: C language uses this model  

Another approach is what we call an object-oriented model. Object-oriented programming organizes a program around its data (what we will refer to objects in future lessons) and a set of well-defined interfaces to that data. It can be characterized as data controlling access to code. Their principles of OOP are as follows:

  • Encapsulation: This concept binds the code and the data it manipulates, to avoid interference and misuse keeping it safe from outside. It actually acts as a shield around the data and the code to avoid arbitrary access from any entity outside the shield.
  • Example: We all have seen capsule, the shield/cover protects the granules from the air and pollutants.
  • Inheritance: The concept of inheritance is known already. We are said to inherit features from our parents and have some distinctive features of our own. A similar concept of inheriting is the property of an entity to acquire features/ properties of another object.
    • Example:  Animal has Age, Gender, and Weight features. The mammal is an Animal. Also, it has litter size and gestation features. When we say Mammal is an Animal, It means Mammal has features of Animal(Age, Gender, Weight) and its distinctive feature(litter size, gestation period) as a whole
  • Polymorphism: The word has Greek origin which means many forms. It is expressed by one interface of multiple methods. It makes a generic interface feasible for a group of related activities. This helps reducing complexity by allowing the same interface to specify a general class of action.

It is the compiler’s job to opt for the set of actions (we will refer to it as method) to be taken according to each situation. The selection is not to be done manually. All needed is to only remember and utilize the general interface

Example: Our smell is polymorphic. We do the same process of smell, but our course of action varies. Smelling something foul we move away. Smelling something aromatic we approach. Smelling some delicious food we crave to eat.

In future lessons, we will dive deep into some more aspects of JAVA and the OOPs concept.