Java Tutorial
Learn Java
Java is one of the world's most widely used programming languages.
Java is free to use, and runs on all platforms.
Adventure Mode
Learn Java in bite-sized quests with XP and streaks. Your progress grows for each new adventure! Free on iOS and Android.
Examples in Each Chapter
Our "Try it Yourself" 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.
Learn by Examples
Learn by examples! This tutorial supplements all explanations with clarifying examples.
Track Your Progress
Create a W3Schools account and get access to more features and learning materials:
- CheckmarkView your completed tutorials, exercises, and quizzes
- CheckmarkKeep an eye on your progress and daily streaks
- CheckmarkJoin the leaderboard and compete with others
- CheckmarkGet your own avatar and unlock new skins
- CheckmarkCreate your own personal website
Note
This is an optional feature. You can study at W3Schools without creating an account.
Java Reference
You will also find complete keyword and method references:
Get Certified in coding
Complete the W3Schools coding course, strengthen your knowledge, and earn a certificate you can add to your CV, portfolio, and LinkedIn profile.