In today's era, the internet and smartphones have become an integral part of our lives. We use our phones for almost all of our day to day tasks. Earlier, we used to shop at mails, queue up in front of banks and make our travel bookings at travel agencies. But now, we can do this comfortably in our homes using smartphones. All of this is made possible by the high-level programming language Java. In this article we will discuss everything we need to know about the class based, object oriented programming language, Java.
What is Java?
Java is an Object Oriented Programming language that is used in a distributed environment on the internet. It is a high level language that is easy to read and understand. It is popularly used in console, GUIs, web, and mobile applications, game development and embedded systems. Apart from these, Java is also used to create software for devices. It is used not only in computers and mobiles but even in electronic devices like televisions, washing machines, air conditioners, and so on. Online forms, banking, and shopping are possible because of Java.
The Invention of Java
Java is a computer based programming language invented by James Gosling and Sun microsystems in 1991. He had a single motto while creating the language, it was "Write Once, Run Anywhere." This meant that the code would have to be written only once, but it could be used anywhere. They named this language "Oak" because of the Oaktree outside Gosling's office. Later, it was named to "Green", then to "Java Coffee" which was named after the coffee from Indonesia, and finally to " Java" in 1995.
Editions of Java
There are three editions of Java. Each programmer can learn any of these editions based on the application they need to create.
❤ Firstly, we have Java Standard Edition, this edition contains core libraries like java.lang, java.util, etc.
❤Secondly, we have Java Enterprise Edition, this edition has APIs like JMS, EJB, JSPs, Servelets, etc.
❤ And lastly, we have Java Micro Edition which is used to program Java in cell phones, set-top boxes, handhelds, and so on.
Java is an object oriented programming language based on C and C++. However, it is improved and simplified to solve the errors in programming. Java files are converted to bit code format using a compiler and then executed by the Java interpreter. The whole Java code is run on the Java Virtual Machine which provides a runtime environment.
Major Concepts of Java
Now, the major concepts in Java are its methods and classes. A method is a block of code that performs a task only when it is called. Consider this example, while watching television, you use the TV remote to change channels. Each button on the remote performs a different task. Methods in Java are the same. We can have methods to add two members or email a person or to convert kilometers to meters.
A group of methods make a class. Classes are used to organize code just like how fruits, vegetables, and clinical products are divided into different sections in a super market. There are a lot of features in Java. Let's start by looking at them one by one.
It has a simple syntax and is very easy to understand and learn. Java language is robust. It eliminates errors that occur in the C and C++ languages. Java also has characteristics like garbage collectors and exception handling. This makes Java very unique. The most popular feature of Java is that it is platform independent. Compilation happens in bytecode, and because of this, Java can run on any machine. It is very secure language as it contains no virus. Java has a feature of multi-threading. The feature of multi-threading helps Java to do multitasking. Java is a portable language as it can run on any platforms and data type sizes are set permanently. So, Java program has a fixed size of the code. Last of all, Java is not as fast as C and C++, but provides higher performance than any other language.
OOPS Concepts in Java
Now, let's see OOPS concepts in Java. Java has four concepts. They are,
In Java we use objects and classes identified with this present reality that makes the code simpler to make and comprehend.
❤Abstraction means showing the relevant information that is needed for a task.
❤Encapsulation makes the Java code secure data is stored within the classes, and it is not easy to access the data.
❤Inheritance as the name suggests, the attributes and characteristics of one class can be inherited by another class. Because of this, coders take less time to create the code.
❤Polymorphism means using the same method for different tasks. In Java, we can utilize the similar object or variable in two different places where their tasks will vary.
In this article we learnt all kinds of things about Java. So you can take the Java programming language and read and benefit.