- Java Tutorial
- What is Java?
- Installing the Java SDK
- Your First Java App
- Java Main Method
- Java Project Overview, Compilation and Execution
- Java Core Concepts
- Java Syntax
- Java Variables
- Java Data Types
- Java Math Operators and Math Class
- Java Arrays
- Java Strings
- Java Operations
- Java if statements
- Java Switch Statements
- Java for Loops
- Java while Loops
- Java Classes
- Java Fields
- Java Methods
- Java Constructors
- Java Packages
- Java Access Modifiers
- Java Inheritance
- Java Nested Classes
- Java Abstract Classes
- Java Interfaces
- Java Interfaces vs. Abstract Classes
- Java Enums
- Java Annotations
- Java Lambda Expressions
- Java Exercises
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 Versions Covered in This Tutorial
The Java language and platform is constantly evolving, and is currently at version 9 (Java 9). New versions of Java are released regularly, sometimes several with years in between, sometimes faster. I keep updating this Java tutorial with new features whenever I have time for it.
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 7
The main new features in Java 7 are:
- Try with resources
- Catching Multiple Exceptions
- Java Fork and Join via ForkJoinPool
- Strings in Java switch statements.
- New file system API in Java NIO 2.0
- Type inference in generic declarations (the socalled "diamond" operator).
- Numeric literals with underscores as visual separators (e.g. 1_000_000).
- Binary numeric literals (e.g. 0b10100101).
- Support for dynamically typed languages in the Java Virtual Machine (JVM).
New in Java 8
The main additions to Java 8 are:
- Java Lambda Expressions
- Java Streams (functional streams)
- JavaFX (bundled with Java SE from Java 8).
New in Java 9
The main additions to Java 9 are:
- Java Modules
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
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.