What is the Java programming language?

logo

Virtual Assistant, Web Design and bookkeeping services

Java was created at Sun Microsystems as a general-purpose programming language similar to C and C++, It is object-oriented and platform-independent. It was originally designed in 1995 for use in consumer electronics. Modern usage include things like writing applications for the IoT, cloud computing and so on. It is widely adopted across billions of devices ranging from smart cards, watches, phones and tablets up to computers and all the way up to super-computers.The Java ecosystem has a number of different Java additions that make up the ecosystem.

The Java ecosystem has a number of different Java additions that make up the ecosystem:

  • Java Card which is the smart card addition and can be used with SIM cards.
  • Java ME Micro-Edition which can work with things like smart TVs, set-top boxes and embedded devices.
  • Java SE Standard-Edition where you star learning the Java programming language, because it contains both the tools , like compilers and Java virtual machines to run your code, but also the structures necessary to support your code that are creating: libraries of classes and functionality.
  • Java MP Micro-Profile is used with micro services and allows you to define for a server how your application should be deployed and run as a microservice.
  • Java EE Enterprise-Edition supports creating applications for the enterprise. This includes web services, passing messages through Java messaging asynchronously and enterprise JavaBeans for sharing code. Also for user interface you can create servlets, Java server pages and Java server faces applications although we are seeing that being used less and less. Mostly, we are seeing Java used in the enterprise in what we call the backend of the enterprise to create reusable, shareable code that can be used by many different applications. This can take the form of web services and is typically how we see Java being used today.

Java is cross-platform because each Java program only needs to be written and compiled once. No platform-specific changes have to be applied to the source-code. A single compiled version of a program can run on any platform.

  1. You write your program in a programming language that can be understood by humans. The solution is called the source code. Since the programming language abstracts away from the detail of the machine code language, we call the former a high-level language and the latter a low-level language.
  2. The source code will then be compiled* into an intermediate code, bytecode, that is the machine code of the virtual machine. The intermediate (virtual machine) code is called bytecode because each instruction is a byte in size.
  3. This byte code can be employed to any computer that runs a Java virtual machine**.
  4. The Java programs themselves are executed inside this Java virtual machine (JVM). The JVM emulates the actual CPU and the computer that the software is running on and translates the bytecodes that were created by the compiler into the actual executable code necessary for that computer.

* Translation of the high-level language source code to a low-level machine code program is usually carried out by a piece of software called a compiler. Translation can also be done by an interpreter, which will translate a line of source code into machine code (as opposed to a whole program) as and when it is required.
During compilation a compiler must first check that the source code conforms to the syntax rules of the language; that is, whether it is correctly formed. Only if this check does not show up problems does the compiler proceed to produce bytecode.
** Another, more portable, model of compilation makes use of a special layer of software called a virtual machine (VM) that resides on top of a real operating system. A VM mimics the behaviour of a piece of hardware and has its own instruction set, just like a real piece of hardware. Furthermore, because it still relies on the operating system layer, a different version of the virtual machine is required for each platform.

Compiling for a virtual machine

Using this intermediate code approach allows low-level, essentially executable, code to be moved unchanged between different computer systems.
The JVM uses a compilation process called dynamic compilation (or just-in-time compilation). Dynamic compilation is particularly attractive when software is developed in relatively small chunks – modules that can be separately compiled. When a request is made to compile a chunk of code, the programming environment’s built-in compiler produces intermediate code for that chunk of code. This is then compiled into machine code by the VM software when the code is first executed, and this real machine code is stored for subsequent executions. Therefore subsequent execution of that code has all the speed that results from simple compilation.

In summary, the advantage of a compilation model that makes use of virtual machines is that it ensures that the intermediate code, no matter on what machine it was compiled, can be translated for execution on many different computers, so long as each computer has the correct VM.

The computer as a layered device.

It is useful to consider a computer as a layered device. A Java program runs on top of the JVM, which runs on top of the operating system, which itself runs on top of the hardware. Java software is portable because it runs on a VM and the JVM masks inherent differences between the underlying architectures and operating systems on different computer platforms. Without the layers of software in modern computers, computer systems would not be as useful and popular as they are today. While the complexity of these underlying layers has increased greatly in recent years, the net effect has been to make computers easier for people to use.

You May Also Like…

The origins of Java

The origins of Java

In 1990, Patrick Naughton, a disgruntled software engineer working for Sun Microsystems (the company was acquired and...

What is procedural programming?

What is procedural programming?

Before object-orientation the predominant method for structuring programs was procedural programming. Procedural...

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *