Related Articles

Released in 1995, the philosophy behind Java is "write once, run anywhere." In other words, a program written in Java can theoretically run on any machine that supports it. While the implementation adds a few caveats to that claim, Java is a powerful and flexible language that can run on many platforms. Nowadays, versions of the Java virtual machine operate on a host of different electronic systems, including computers and smartphones.

High-Level Languages and Computer Code

Java is a high-level language, which represents logical computer concepts in a fashion that is easier for humans to understand than low-level machine code or assembly language. However, this means that in order to run on a machine, the code must be compiled into machine code or interpreted by a special-purpose machine. To achieve its goal of "Write once, run anywhere," Java does both: a Java compiler converts Java code into machine-readable bytecode, then the Java Virtual Machine interprets the code for the computer it runs on.

Java Virtual Machine (JVM)

Individual computers often use different machine languages, so if you compiled a Java program to a single machine language, the compiled program would not be able to run on multiple machines. To solve this problem, the Java Virtual Machine is a simulated machine which has multiple implementations for each computers. Once Java code is compiled into JVM bytecode, the bytecode then runs according to the JVM. The JVM then passes the actual processing work to the processor in its own language. The JVM is part of the Java Runtime Environment (JRE).

Writing Java Code: Classes, Methods and Variables

Java is an object-oriented language, which means all code is associated with a class of objects. An object is a simulated data structure which behaves according to the specifications of its class -- the act of making Java code involves creating and altering these classes. Specific class behaviors are defined by snippets of code called "methods," and properties of objects and classes are defined by "variables."

Java Libraries and Packages

Java's functionality comes from its powerful API, which is automatically included with its developer environment. It can handle complex data structures, sorting algorithms, networking protocols, classes and methods to create graphical user interfaces, and more. Capabilities of Java are continually expanded with each version, with new classes and methods to achieve more varied tasks. You can also create your own libraries and include them as a dependency.

References (1)

About the Author

Amber Viescas is a 23-year-old freelancer who has been writing since 2009, penning articles for sites such as Nu Home Source. She has a Bachelor of Arts in computer science from Swarthmore College and has co-published a paper in the "Journal of Parallel and Distributed Computing."