Intro to Java
Beginner
About Java →
Variables, ifs, loops, arrays and methods. 25 bite-size lessons.
0 / 25 lessons complete
Start Lesson 1
Open the Java sandbox ↗
1
Variables
Store a whole number in a variable and print it.
2
Variable Addition
Add two variables together and print the result.
3
Strings
Store text in a String and print it.
4
String Concatenation
Join two Strings together with +.
5
String and Number
See what happens when you add a number to text.
6
Booleans
Create a true/false variable and print it.
7
If Statement
Only run code when a condition is true.
8
Else Statement
Run one thing when true, another when false.
9
Else If Statement
Check several conditions, one after another.
10
OR Operator
Combine conditions with || (OR).
11
AND Operator
Combine conditions with && (AND).
12
Statements and Operators
Mix &&, == and else if in one program.
13
Arrays
Store a list of numbers in one variable.
14
Boolean Array
Make an array of true/false values.
15
String Array
Make an array of words.
16
Mixed Type Array
One array holding text, a number and a boolean.
17
For Loop
Visit every item in an array, one by one.
18
For Loop Addition
Add up every number in an array.
19
For Loop Booleans
Combine a loop with an if statement.
20
While Loop
Loop for as long as a condition stays true.
21
Break
Escape from a loop with break.
22
Continue
Skip one trip around a loop with continue.
23
Random Number Function
Write your own method and call it.
24
Find Five
Keep calling a method until it returns 5.
25
Find Fifty
Same hunt, bigger haystack: find 50 out of 100.