Java¶
Java is a programming language designed by James Gosling in the early 90s. Java is an object-oriented programming language that can be used in a large number of applications. It is commonly used within web servers, for example by Google. Unlike C or Go, Java does not compile to machine code, but rather to Java bytecode. It is Java bytecode which can be executed using the Java Virtual Machine.
Bytecode¶
Java uses bytecode to eliminate the issues of running across different platforms compiling for each one. This is the basis of the line commonly attributed to Java: "Write once, Run anywhere".
Virtual Machine¶
The Java Virtual Machine, or JVM for short, is a piece of software mimicking the function of a computer, to allow for the execution of Java bytecode. In this 'machine', Java bytecode is machine code.
Example¶
The following is a simple example of Java, with a program printing "Hello, World!".
package me.jamiemansfield.example;
public final class HelloWorldMain {
public static void main(final String[] args) {
System.out.println("Hello, World!");
}
private HelloWorldMain() {
}
}
Except as otherwise noted, the content of this page is licenced under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Mozilla Public License 2.0.