Author: Jeslyn Guo
In the programming world, we often hear people talking about the various coding languages that are available, such as Python, Java, HTML, C/C++, and much more. But what really is Java and what is it used for in the real world?
Java is a programming language and computing platform that was first released in 1995. It dominated the field in the early 2000s and remains a widely used programming language today. It is known as a general-purpose programming language, meaning that it can be applied across a wide variety of domains. In contrast, domain-specific languages are specialized to a particular domain and used for a specific purpose, such as HTML, which is used to structure web pages. Java is a high-level programming language, meaning that it is simple and has understandable syntax that we can work with.
There are a few distinctive benefits and characteristics of Java, the main one being that it is portable and platform independent. In the computer science world, portability means the ability to use the same software in different environments without any major changes to the code. Specifically, the purpose of Java is to allow developers to write once and run anywhere. This means that a Java program can be developed on one device, then compiled into bytecode, and run on any other device equipped with a Java Virtual Machine (JVM). If this process sounds unfamiliar to you, we will discuss compiling and what a JVM is later, so this should make more sense soon.
Another characteristic of Java is that it is an object-oriented programming language. Objects are data structures that are defined with their own attributes and methods. To give an example of this, let’s say that we want to create a Person object. To create a person, we need to give it attributes or characteristics such as age, height, eye color, etc. Additionally, the person needs to be able to do things such as walking or talking, which are known as methods. In simpler terms, you can think of attributes of an object as adjectives, and methods as verbs. In Java, software is designed by making various objects interact with each other.
Let’s go back and look at how the compiler works in Java. Compiling is the process in which high level code is translated into machine code, which is what the computer works in. Machine code is made up of 0s and 1s, and is the lowest level programming language. As you can imagine, it would be really hard for programmers to code in just 0s and 1s! This is why we have high-level programming languages such as Java with understandable syntax, and compilers to translate this high level code into machine code. Compiling in Java is a two-step process:
- The source file (ending in .java) is passed through the first compiler and translated into bytecode, which is an intermediate-level language composed of symbols to represent instructions.
- The bytecode file (ending in .class) is then passed through the Java Virtual Machine (JVM) which is the second compiler that translates bytecode into machine code that the computer can understand.
As you can see from this process, as long as a device has a JVM, then a Java program can be run on that device. This is where Java gets its “write once, run anywhere” catchphrase.
Now that we’ve discussed the main features of Java and how it works, you might be wondering how this is actually applied in real life programs. Java is used everywhere around us, from android apps to the e-commerce and financial services industries. Large investment bank companies such as Goldman Sachs and Citigroup use Java to write their electronic trading systems and data processing systems. Java is also often used for games as well; the popular game Minecraft is built in Java. Many websites such as Google are based mainly in Java, and even Amazon uses Java based applications in its company.
Java programming is truly used around us everywhere. The best part is that it is easy to learn and use! If you are interested in learning more about Java or want to get started coding your own project, feel free to check out the other resources on our website and become an expert at Java starting today.