After 28 years, Java is still a popular choice when developing applications.
In this tutorial, we’ll explore the fundamentals of Java, its history, key features, and its role in the world of software development.
Java belongs to object-oriented programming languages. Object-oriented programming (or OOP for short) is a paradigm that organizes software around classes and objects. Unlike the other concepts, like procedural or functional programming, in OOP, classes represent the main building blocks. Moreover, we write our code inside some classes.
Additionally, we can make every class “alive” by instantiating it (just a fancy word for creating an object). Objects communicate with each other, sharing information, changing states, and performing actions.
Usually, when creating classes, we bring them close to real life and the way we think.
For instance, let us imagine we want to create a calculator. Instead of a physical calculator, we would have the Calculator class. Additionally, each action (addition, subtraction, multiplication, division, etc.) would be represented by methods.
Now, let us take a brief overview of the Java history.
1. Historia Magistra Vitae est
Once upon a time, there was a company called Sun Microsystems. In 1991 the company decided to be different than all the other companies. Thus, they started a project named The Green Project. And no, it was not about the environment and saving the Mother Earth. The main goal of this project was to create a programming language that would be able to run on different operating systems.
James Gosling (let us call him the Father), worked in his office on this new super magic cool programming language. Now, back then he had a problem – he did not know how to name the language. And then, one sunny day, it came up to him. He looked at his window and saw the big oak. Therefore, he decided to name the language Oak.
Nevertheless, the marketing team from Sun noticed there was already an IT company named Oak. So, they were back at square one. However, they decided to discuss about new name over a nice cup of coffee. On this coffee, they agreed the name of the new language would be Java.
The first Java version was published in 1995.
After 15 years, Oracle decided to purchase Sun Microsystems will all its products (Java included). And here we are, more than 10 years later. At the time this book was written, the newest Java version was Java 21. Oracle tries to release a new Java version once a year.
2. How Java Work?
We, developers, represent only one piece of a big puzzle. Our job is to write commands that will perform desired actions. And this is where our job finishes. After, Java says “I am the captain now.” and takes control. Java has a best (although very strict) friend called the compiler. The compiler translates our commands into the commands Java Virtual Machine (JVM) understands. JVM is responsible for running our application.
The simplified process looks like the following:
- Firstly, we need to create a file to put our code. This file is known as a source code and uses the .java extension. In this file, we write a code using Java programming language syntax. We can write code inside a text editor or use something called IDE (Integrated Development Environment). This is where our job ends and Java takes control instead of us.
- As mentioned earlier, Java has a buddy named compiler. You can think of the compiler as a Grammar Nazi. The main task of the compiler is to check your Java syntax and scream if something is not correct. Furthermore, when you write code, the compiler will not check if the code makes sense (logically). Thus, it will only check if you made some syntax mistakes. The compiler will transform our code into the code Java Virtual Machine can understand. This code is called the bytecode. He will create a new file with a .class extension.
- Java Virtual Machine, or JVM in short, is another Java friend. The JVM has one significant job to do – run our application.
5. Key Takeaways
In this tutorial, we got an introduction to Java programming language.
Java has a large and active developer community, which means there are ample resources, libraries, and frameworks available for various applications, such as web development (e.g., Spring Framework), mobile app development (e.g., Android), and more.