Learn Java
Java is one of the world's most widely used programming languages.
Java is free to use, and runs on all platforms.
Examples in Each Chapter
an online editor makes it easy to learn Java. You can edit Java code and view the result in your browser.
Example
public class Main {
public static void main(String[] args) {
System.out.println("Hello World");
}
}
Exercises
Many chapters in this tutorial end with an exercise where you can check your level of knowledge.
What You'll Learn
This tutorial will guide you step by step, with examples and exercises along the way:
- Java syntax and basic structure
- Variables, data types, and operators
- Conditions and loops
- Methods and parameters
- Arrays and strings
- Object-oriented programming
- Classes, objects, inheritance, and polymorphism
- Exception handling
- File handling
- Collections and useful built-in classes
Java Quiz Check your understanding with a short quiz and see how well you know Java. Start Java Quiz
Learn by Examples Learn by examples! This tutorial supplements all explanations with clarifying examples. See All Java Examples
Java Reference
You will also find complete keyword and method references:
Reference Overview Java Keywords String Methods Math Methods Output Methods Arrays Methods ArrayList Methods LinkedList Methods HashMap Methods Scanner Methods File Methods FileInputStream FileOutputStream BufferedReader BufferedWriter Iterator Methods Collections Methods System Methods Errors & Exceptions