bugl
bugl
HomeLearnPatternsPathsSearch
HomeLearnPatternsPathsSearch

Loading lesson path

Learn/Java

Java

Java Tutorial

Java Tutorial focused on Java Introduction and related concepts.

Lesson 1

Java Tutorial

Java is one of the world's most widely used programming languages.

Read lesson →Loading…
Lesson 2

Java Introduction

Java is a popular and powerful programming language, created in 1995.

Read lesson →Loading…
Lesson 3

Java Getting Started

However, if you want to run Java on your own computer, follow the instructions below.

Read lesson →Loading…
Lesson 4

Java Syntax

Every line of code that runs in Java must be inside a class . The class name should always start with an uppercase first letter. In our example, we named the class Main .

Read lesson →Loading…
Lesson 5

Java Statements

A computer program is a list of "instructions" to be "executed" by a computer.

Read lesson →Loading…
Lesson 6

Java Output / Print

You learned from the previous chapter that you can use the println() method to output values or print text in Java:

Read lesson →Loading…
Lesson 7

Java Output Numbers

You can also use the println() method to print numbers.

Read lesson →Loading…
Lesson 8

Java Comments

Comments can be used to explain Java code, and to make it more readable. It can also be used to prevent execution when testing alternative code.

Read lesson →Loading…
Lesson 9

Java Variables

Variables are containers for storing data values.

Read lesson →Loading…
Lesson 10

Java Print Variables

The println() method is often used to display variables.

Read lesson →Loading…
Lesson 11

Java Declare Multiple Variables

To declare more than one variable of the same type , you can use a comma-separated list:

Read lesson →Loading…
Lesson 12

Java Identifiers

All Java variables must be identified with unique names .

Read lesson →Loading…
Lesson 13

Java Constants (final)

When you do not want a variable's value to change, use the final keyword.

Read lesson →Loading…
Lesson 14

Java Data Types

As explained in the previous chapter, a variable in Java must be a specified data type:

Read lesson →Loading…
Lesson 15

Java Numbers

Primitive number types are divided into two groups:

Read lesson →Loading…
Lesson 16

Java Boolean Data Types

Very often in programming, you will need a data type that can only have one of two values, like:

Read lesson →Loading…
Lesson 17

Java Characters

The char data type is used to store a single character. The character must be surrounded by single quotes, like 'A' or 'c':

Read lesson →Loading…
Lesson 18

Java Data Types Example

Here's a real-life example of using different data types, to calculate and output the total cost of a number of items:

Read lesson →Loading…
Lesson 19

Java Non-Primitive Data Types

Non-primitive data types are called reference types because they refer to objects.

Read lesson →Loading…
Lesson 20

Java var Keyword

The var keyword was introduced in Java 10 (released in 2018).

Read lesson →Loading…
Lesson 21

Java Type Casting

Type casting means converting one data type into another. For example, turning an int into a double .

Read lesson →Loading…
Lesson 22

Java Operators

Operators are used to perform operations on variables and values.

Read lesson →Loading…
Lesson 23

Java Arithmetic Operators

Arithmetic operators are used to perform common mathematical operations.

Read lesson →Loading…
Lesson 24

Java Assignment Operators

Assignment operators are used to assign values to variables.

Read lesson →Loading…
Lesson 25

Java Comparison Operators

Comparison operators are used to compare two values (or variables). This is important in programming, because it helps us to find answers and make decisions.

Read lesson →Loading…
Lesson 26

Java Logical Operators

As with comparison operators , you can also test for true or false values with logical operators.

Read lesson →Loading…
Lesson 27

Java Operator Precedence

When a calculation contains more than one operator, Java follows order of operations rules to decide which part to calculate first.

Read lesson →Loading…
Lesson 28

Java Strings

Strings are used for storing text.

Read lesson →Loading…
Lesson 29

Java String Concatenation

The + operator can be used between strings to combine them. This is called concatenation :

Read lesson →Loading…
Lesson 30

Java Numbers and Strings

Java uses the + operator for both addition and concatenation.

Read lesson →Loading…
Lesson 31

Java Special Characters

Because strings must be written within quotes, Java will misunderstand this string, and generate an error:

Read lesson →Loading…
Lesson 32

Java Math

The Java Math class has many methods that allows you to perform mathematical tasks on numbers.

Read lesson →Loading…
Lesson 33

Java Booleans

Very often in programming, you will need a data type that can only have one of two values, like:

Read lesson →Loading…
Lesson 34

Java If ... Else

Conditions and if statements let you control the flow of your program - deciding which code runs, and which code is skipped.

Read lesson →Loading…
Lesson 35

Java Else

The else statement lets you run a block of code when the condition in the if statement is false .

Read lesson →Loading…
Lesson 36

Java Else If

Use the else if statement to specify a new condition to test if the first condition is false .

Read lesson →Loading…
Lesson 37

Java Short Hand If...Else (Ternary Operator)

There is also a short-hand if else , which is known as the ternary operator because it consists of three operands.

Read lesson →Loading…
Lesson 38

Java Nested If

You can also place an if statement inside another if . This is called a nested if statement.

Read lesson →Loading…
Lesson 39

Java Logical Operators in Conditions

You can combine or reverse conditions using logical operators . These work together with if , else , and else if to build more complex decisions.

Read lesson →Loading…
Lesson 40

Java Switch

Instead of writing many if..else statements, you can use the switch statement.

Read lesson →Loading…
Lesson 41

Java While Loop

Loops can execute a block of code as long as a specified condition is true.

Read lesson →Loading…
Lesson 42

Java Do/While Loop

The do/while loop is a variant of the while loop. This loop will execute the code block once , before checking if the condition is true . Then it will repeat the loop as long as the condition is true…

Read lesson →Loading…
Lesson 43

Java For Loop

When you know exactly how many times you want to loop through a block of code, use the for loop instead of a while loop:

Read lesson →Loading…
Lesson 44

Java Nested Loops

It is also possible to place a loop inside another loop. This is called a nested loop .

Read lesson →Loading…
Lesson 45

Java For Each Loop

There is also a " for-each " loop, which is used exclusively to loop through elements in an array (or other data structures ):

Read lesson →Loading…
Lesson 46

Java Break and Continue

The break statement can also be used to jump out of a loop .

Read lesson →Loading…
Lesson 47

Java Arrays

Arrays are used to store multiple values in a single variable, instead of declaring separate variables for each value.

Read lesson →Loading…
Lesson 48

Java Arrays Loop

You can loop through the array elements with the for loop, and use the length property to specify how many times the loop should run.

Read lesson →Loading…
Lesson 49

Java Multi-Dimensional Arrays

A multidimensional array is an array that contains other arrays.

Read lesson →Loading…