+91 81900 98289

Java Tutorial

Learn Java

Java is a general-purpose language teams use for web services, Android apps, and business systems.

A program is a class with a main method. You compile it with javac and run it with java.

Start with the example on this page, then follow the lesson list on the left.

Learn Java now →
Asmorix Chennai campus reception

Train with Asmorix

Classroom Java training in Chennai, with projects and a full syllabus.

Java training →

Learning by Examples

Each example is a complete class. Run shows the expected output. To compile a change, save the file and use javac on your machine. This browser does not start a JVM.

Example

Save this as Hello.java. The class name and the file name match. println writes one line and then moves to the next line.

public class Hello { public static void main(String[] args) { System.out.println("Hello, Chennai"); } }

Java Syntax

A class, a main method, and a semicolon after each statement.

Java SyntaxJava OutputJava Comments

Java Variables

Declare a type, assign a value, and print it.

Java VariablesJava Data TypesJava Strings

Java OOP

Classes, constructors, inheritance, and interfaces.

Java OOPJava ClassesJava Inheritance

Java Collections and Files

A growing list, a map of keys, and text files.

Java ArrayListJava HashMapJava File Handling

Java Exercises

Count how many marks are 50 or above, then try the average yourself.

Java Exercises
Quick check
Exercise

Which line prints Hello from a Java main method?