Introduction to Java
Java was released by Sun Microsystems in 1995 and is now maintained by Oracle and a large open-source community. It's one of the most widely used languages in the world, especially for big business systems.
Where Java is used
| Example | Where it runs |
|---|---|
| phone, tablet and TV apps, written in Java or | |
| the back ends of banks, insurers, airlines and online shops | |
| storing and processing huge data sets, on the Java platform | |
| streaming data between systems, on the Java platform | |
| the editor many Java developers use, itself written mostly in Java |
Games too: Minecraft's original edition is written in Java.
Write once, run anywhere
Java source code is compiled into bytecode, not machine code for one particular processor. Bytecode runs on the Java Virtual Machine (JVM), which exists for Windows, macOS, Linux and more, so the same compiled program runs everywhere.
Diagram
Main.java --javac--> Main.class (bytecode) --JVM--> runs on any OSYour first look
Java
public class Main {
public static void main(String[] args) {
System.out.println("Hello, Java!");
}
}The next lesson explains every word. For now, notice that Java is strict and explicit: everything lives inside a class, and every statement ends with a semicolon.
Why learn Java?
- Strong typing catches many mistakes before the program runs.
- Object-oriented design scales to very large codebases.
- Huge job market and a mature ecosystem of libraries and tools.
Finished this lesson?Mark it complete to earn +20 XP and move your progress on.