Tech and Media Labs
This site uses cookies to improve the user experience.

Java Tutorial

Jakob Jenkov
Last update: 2019-03-04

Java was originally a programming language invented by Sun Microsystems (Sun was acquired by Oracle in January 2010). Since Java's invention it has become more than just a language. It is also a platform with a set of standard APIs and standard tools. Just exactly what Java has evolved into is covered in more detail in the next text in this tutorial, about what Java is today.

This Java tutorial trail (set of articles) describes the Java programming language. The intention of this tutorial is mostly to be a compressed introduction to Java for developers who already know a bit about programming and object oriented concepts. I will try to explain the various different concepts as I use them, but a bit of programming background will helpful.

The target audience for this Java tutorial is both beginners who need to learn Java almost from scratch, and more experienced developers who just need to catch up on features they haven't used.

Java Topics Covered

This Java tutorial covers the following Java topics:

  1. What is Java?
  2. Installing the Java SDK
  3. Your First Java Application
  4. The Java main() Method
  5. Java Project Overview, Compilation and Execution
  6. Java Core Concepts
  7. Java Syntax
  8. Java Variables
  9. Java Data Types
  10. Java Math Operators and Math Class
  11. Java Arrays
  12. Java Strings
  13. Java Operations
  14. Java if Statement
  15. Java Ternary Operator
  16. Java switch Statement
  17. Java for Loop
  18. Java while Loop
  19. Java Classes
  20. Java Fields
  21. Java Methods
  22. Java Constructors
  23. Java Packages
  24. Java Access Modifiers
  25. Java Inheritance
  26. Java Nested Classes
  27. Java Abstract Classes
  28. Java Interfaces
  29. Java Interfaces vs. Abstract Classes
  30. Java Enums
  31. Java Annotations
  32. Java Lambda Expressions
  33. Java Modules
  34. Java Exercises

Java Versions Covered in This Tutorial

The Java language and platform is constantly evolving. New versions of Java are now released approximately every 6 months. I will update this tutorial with the latest features as fast as I am able to.

This particular tutorial trail only covers the core Java language features. It does not cover the Java APIs. Many of the Java APIs are covered elsewhere on this tutorial site.

If you are just looking for what is new in each Java version, the following sections will list the main additions to the latest Java versions.

New in Java 12

The main additions to Java 12 are:

  • A low pause time garbage collector called Shenandoah.
  • Switch expressions (preview - may be removed from Java again).
  • JVM Constants API.
  • Abortable mixed collections in G1 (garbage collections).
  • Promptly return unused committed memory from G1.

Here is a link to the full list of changes in Java 12.

New in Java 11

The main additions to Java 11 are:

  • Removed Java EE and Corba modules from JDK.
  • HTTP Client made standard (the one added in Java 9).
  • Java var keyword allowed as lambda expression parameter type.
  • Key agreement via elliptic curve cryptography.
  • Unicode 10.
  • New cryptographic algorithms.
  • Launch single file source code programs (compiled when executed).
  • TLS 1.3 support.
  • Deprecate the Nashorn JavaScript engine

Here is a link to the full list of changes in Java 11.

New in Java 10

The main additions to Java 10 are:

  • Local-Variable Type Inference
  • Parallel Full Garbage Collection for G1 (a Garbage Collector)
  • Graal included as experimental JIT compiler
  • Several internal, JVM and platform level changes

Here is a link to the full list of changes in Java 10.

New in Java 9

The main additions to Java 9 are:

Here is a link to the full list of changes in Java 9.

New in Java 8

The main additions to Java 8 are:

New in Java 7

The main new features in Java 7 are:

Get Started Learning Java

This page is merely an introduction to the Java tutorial trail. The real explaining starts from the next text (page) in the trail, What is Java? . You can see all the articles in this tutorial on every page, in the top left part of each page.

As you read the tutorials I would recommend that you play around with code examples etc. Personally, I learn better when I type in examples and run them. In order to do this, you need to:

  • Write the Java code
  • Compile the Java code
  • Execute the compiled Java code

The easiest way to do these three steps is to use a Java IDE (Integrated Development Environment). You can edit the Java code, compile it and execute it, all from within the IDE. There are three popular Java IDE's available:

Both Eclipse and Netbeans are free, and IntelliJ IDEA has a free community edition which is just fine when you start learning Java. Personally I use IntelliJ IDEA, but I have used all three IDEs from time to time. All of them will be fine for you to start out with.

If you do not want a full IDE, you can write Java code in a standard text editor, like Notepad (on Windows) or Notepad++ (free text editor). Java file names have to end with the .java extension. You can then compile the Java files into Java byte code, and use the java command to run the compiled byte code.

In order to compile and execute Java code this way, you need to download and install the Java SDK (Java Software Development Kit). Just click on this link: Java 8 from Oracle. Download the SDK, and install it. Once the Java SDK is installed, you can compile and run Java programs. How all this is done is explained in more detail in later texts.

Feel Free to Contact Me

If you disagree with anything I write here in this Java tutorial, or just have comments, questions, etc, feel free to send me an email. You wouldn't be the first to do so. You can find my email address on the about page.

Jakob Jenkov

Copyright  Jenkov Aps
Close TOC