Java Introduction
Java is a general purpose, object oriented language that runs on the Java Virtual Machine (JVM). The same compiled program runs on Windows, macOS and Linux. It is used for Android apps, banking systems, web back ends and large business software.
Java is statically typed: every variable has a type that is checked before the program runs, which catches many mistakes early.
Example
public class Main {
public static void main(String[] args) {
System.out.println("Hello, Java!");
}
}Result
Hello, Java!
- In the examples below, the code inside main is shown on its own. Put it inside public static void main(String[] args) to run it.
Exercise
Print a line of text.
System.out.("Hi");
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.