Programming in Java

Home / Programming in Java

Programming in Java

May 4, 2020 | programming | No Comments

Java is a general purpose programming language that was created by Sun Microsystems. It pioneered features now seen in other programming languages such as the use of a virtual machine, which allows for easy code portability. The fact that it is a high-level language and has a large standard library makes it easier to write code, but can also cause performance issues.

A primary feature that Java innovated was the use of the virtual machine. Instead of the compiler outputting an executable written for a specific computer architecture, it turns the source code into what is known as bytecode, a form of machine code that runs on the virtual machine. Then, whenever someone wants to run a Java program, they just need to have the virtual machine installed. This is called “write once run anywhere” because it allows the developer to create a single application that will run in any environment.

The virtual machine also makes it easier to implement managed code tools such as a garbage collector. All Java memory management is taken care of by the garbage collector built into the virtual machine, which prevents memory leaks from occurring in Java applications.

One of the biggest reasons that developers use Java today is because of Java applets, which allows the language to be used as a web programming language. Most web browsers have the Java plugin installed, so you can simply write Java code, place it on a web page, and have it execute inside the web browser. And because it runs in the Java virtual machine, you only need to create a single application and place it on the web server in order for anyone to be able to use it. Java applets are often used in complicated browser-based games such as RuneScape, but they can be used for any sort of web-based development.

However, Java is not without its drawbacks. One of the biggest problems that it has historically had is performance issues. Since all of the code is executed inside a virtual machine, there is a performance penalty. Additionally, low-level code tools are not available. The garbage collector can not be disabled, meaning that writing real-time code is a significant problem, as the garbage collector can suspend the program at any time in order to clean up the memory. Standard pointer arithmetic is not available, as the language abstracts away the use of memory into the various Java classes.

Java can be a useful general-purpose programming language, but it is different from other common languages. While that gives it some advantages, such as the use of Java applets, it also has some disadvantages, such as lower performance.

,

About Author