Workshop · Java · Kids
JV010 Java for kids: the Robot Factory
Build Pixel the robot one part at a time. Every five-minute step prints something you can see: a robot face, a row of robots, a mood, a dice roll, a countdown. Along the way you learn what a program is, how to store settings, repeat things, choose between moods and teach the robot tricks, all in real Java that runs in your own seat.
Open Coding Tutor at codingtutor.agilesystemsoftware.com, pick JV010 from the course button in the chat and press Tutor me. Every lesson, demo and hands-on step is also published below.
Who it is for
Children aged 8 to 12 with a guardian or teacher nearby. They set up the seat and sit close; the child reads, types and runs. No account details, no personal information, no reading beyond short sentences.
A kids course: a guardian or teacher sets up the seat and stays nearby. The tutor never asks for personal details, answers come through buttons or by voice, and nothing is shared or ranked. How kids courses work.
What you will be able to do
- Run a Java file from the terminal and change what it prints
- Draw with text using println, one line at a time
- Find the line a red error message points at and fix it
- Store the robot's settings in named boxes (variables) and do sums with them
- Repeat things with a for loop and count up or down
- Choose a mood with if and else, and roll a dice
- Teach the robot a trick with a method, give it inputs and get an answer back
Syllabus
Every session ends in a lab the machine checks on your own code. Open a session's mini steps to read each lesson, demo and hands-on task; the badge shows how far the engine can verify it: checked · T3 a check runs over your files, proven · T4 the grader also tries inputs you did not see, tutored · T0 done on your word. Each step has its own link (for example #s1-1).
Session 1 · Meet Pixel
Four short steps with a grown-up nearby. A program is a page of instructions the computer reads from the top. We run Pixel the robot's first program, change what it says, draw a robot face out of letters and symbols, and learn that a red error message is just the computer pointing at a line. Live in the seat: the file Robot.java run with one command, a word swapped and run again, a face appearing line by line, and a missing semicolon found and fixed.
Lab Print Pixel's badge: a five-line robot made of text with the model word PIXEL-1 on the last line. It must run with no red messages. Session 1 show.
4 mini steps · ~23 min
1.1Wake up, Pixel5 minchecked · T3
Predict
The file says System.out.println("Beep!"); What will the robot say when we run it?
Lesson
A program is a list of instructions in a file. Java reads it from the top and does each line. Our rhythm is always the same: run it, look at what it printed, change one word, run it again.
Demo
The tutor opens java/jv010/demo/Robot.java, runs java Robot.java in the terminal and Pixel says Beep!. Then the tutor changes Beep! to Boop! and runs it again so both answers are on the screen.
On screen
Explorer → java/jv010/demo/Robot.java → Terminal → java Robot.java → change the word → run again.
Hands-on
Open java/jv010/s1/Robot.java (a copy the tutor made). Change what Pixel says to a robot word of your own, like Zap or Whirr, then run it. Add a second println so Pixel says two things.
Explain
Say in one sentence what the computer did with the file.
Check
Pixel says two things of your own — checked (T3):
seat_run1.2Draw a robot face6 minchecked · T3
Predict
Three println lines print [o o], then | - |, then \___/. How many lines appear on the screen?
Lesson
println means print this and go to the next line. If you print one row of a picture per line, the rows stack up and you get a drawing made of letters and symbols.
Demo
The tutor adds five println lines to the demo file, one row each, and a robot face with square eyes and an antenna appears in the terminal. Then the tutor swaps the eyes from o to O to show how easy it is to change.
Hands-on
In java/jv010/s1/Face.java print a robot face at least four rows tall: an antenna row, an eyes row with two letters, a mouth row, and a chin row. Make it look like your own robot, not the demo's.
Explain
Why did we need one println for each row?
Check
Face.java prints a face at least four rows tall — checked (T3):
seat_run1.3The red message is a helper6 minchecked · T3
Predict
Line 4 is missing its semicolon at the end. What does Java do?
Lesson
When something is wrong, Java shows a red message. It is not angry: it tells you the line number and what is missing. Go to that line, look closely, fix one thing, run again.
Demo
The tutor removes a semicolon in the demo file, runs it, and reads the red message slowly: file name, line number, the word expected. The tutor goes to that line, puts the semicolon back, and Pixel speaks again.
Hands-on
Open java/jv010/samples/s1/Broken.java and copy it to java/jv010/s1/Fixed.java. It has two mistakes: a missing semicolon and a missing quote mark. Read each red message, fix the line it names, until Pixel says Fixed me!.
Explain
What two things does the red message tell you?
Check
Fixed.java runs and says Fixed me! — checked (T3):
seat_run1.4Show: Pixel's badge6 minchecked · T3
Predict
The badge needs 5 rows. How many println lines is that?
Lesson
A show is a small program you make all by yourself from what you learned: print rows to draw, change the words, and fix any red message by reading the line number it names.
Demo
The tutor shows a finished badge in the demo file: a top border, two face rows, a bottom border and the model word, then runs it once so the shape is clear, and closes the file so the learner builds their own.
Hands-on
In java/jv010/s1/Badge.java print Pixel's badge: exactly five rows. Rows 1 and 5 are borders made of + and - signs, rows 2 and 3 are the face, and row 4 says MODEL: PIXEL-1. Run it with no red messages.
Explain
Which row would you change to give the robot a new model name?
Check
Badge.java prints a five-row badge with MODEL: PIXEL-1 — checked (T3):
seat_run
Session 2 · Robot settings
Four steps about boxes with labels. A variable is a box with a name on it that holds one thing: a word or a number. We give Pixel a robot name, a battery number and a colour, do sums with the battery number, join words together, and let a grown-up type a robot name when the program starts. Live in the seat: three boxes filled and printed, a battery that goes down by 10 each time we run, a sentence glued from three pieces, and a name that comes from the command line.
Lab Print Pixel's settings card from two words typed when the program starts: the robot's name and its battery number. The card shows the name, the battery and the battery after one hour (10 less). Session 2 show.
4 mini steps · ~22 min
2.1Boxes with labels5 minchecked · T3
Predict
We write int battery = 90; then System.out.println(battery); What prints?
Lesson
A variable is a box with a label. int boxes hold whole numbers, String boxes hold words. You put something in with =, and when you print the label without quotes you get what is inside.
Demo
The tutor makes three boxes in java/jv010/demo/Settings.java — String robotName = "Pixel", int battery = 90, String colour = "silver" — prints each, then changes battery to 55 and runs again to show the box changed.
Hands-on
In java/jv010/s2/Boxes.java make three boxes: a String for the robot's name (make one up), an int battery, and a String colour. Print each one on its own line.
Explain
What is the difference between printing "battery" with quotes and battery without?
Check
Boxes.java declares a String, an int and prints three lines — checked (T3):
seat_fileseat_run2.2Numbers do sums5 minchecked · T3
Predict
int battery = 90; System.out.println(battery - 10); What prints?
Lesson
Number boxes can do sums: + adds, - takes away, * multiplies. Java works out the sum and prints the answer. You can also put the answer in a new box, like int later = battery - 10;.
Demo
The tutor prints battery - 10, battery * 2 and battery + 5 from the demo file, then adds int afterHour = battery - 10; and prints a sentence about it, so the sum is kept in a box.
Hands-on
In java/jv010/s2/Sums.java make int battery = 70; and int legs = 2;. Print the battery after one hour (10 less), the battery doubled, and how many legs four robots have (legs times 4).
Explain
What does Java do before it prints battery - 10?
Check
Sums.java prints 60, 140 and 8 — checked (T3):
seat_run2.3Words join up6 minproven · T4
Predict
String name = "Pixel"; System.out.println("Hi " + name + "!"); What prints?
Lesson
Plus between words glues them into one longer word. You can glue a box and some text to make a sentence. A program can also be given words when it starts: args[0] is the first one typed after the file name.
Demo
The tutor prints "Hi " + robotName + "!" from the demo, then changes the file to read String robotName = args[0]; and runs java Settings.java Bolt, then java Settings.java Zippy, so the greeting changes each time.
Hands-on
In java/jv010/s2/Hello.java take the robot's name from args[0] and print two lines: "Hello, I am <name>." and "<name> is ready!". Run it with java Hello.java Pixel and then with a different robot name.
Explain
Where did the robot name come from this time?
Check
Hello.java greets the robot named on the command line — proven (T4):
seat_run2.4Show: the settings card6 minproven · T4
Predict
args[1] is the word "80". To do sums with it we write int battery = Integer.parseInt(args[1]); Why?
Lesson
Everything typed after the file name is a word, even "80". Integer.parseInt turns a word of digits into a number box, and then the sums from 2.2 work. Put the pieces together and you have a card.
Demo
The tutor builds the demo card: name from args[0], battery from Integer.parseInt(args[1]), a border line, the name, the battery, and the battery after one hour, then runs it with Bolt 80 and with Zippy 45.
Hands-on
In java/jv010/s2/Card.java read the robot's name from args[0] and the battery from args[1]. Print four lines: a border of = signs, "Robot: <name>", "Battery: <number>", and "After one hour: <number minus 10>".
Explain
Why does the card work for any robot name and battery?
Check
Card.java prints the settings card for any robot — proven (T4):
seat_run
Session 3 · Again and again
Four steps about repeating. A for loop says do this that many times, and it can count while it does it. Pixel beeps five times without five lines of code, counts down to blast-off, builds a staircase of stars, and finally a whole row of robots. Live in the seat: one println inside a loop printing five beeps, the counter printed each time, a staircase that grows one star per row, and a robot army whose size comes from the command line.
Lab Print a robot army: as many little robots as the number typed when the program starts, each one numbered, then a line that says how many reported for duty. Session 3 show.
4 mini steps · ~22 min
3.1Beep five times5 minchecked · T3
Predict
for (int i = 0; i < 5; i++) { System.out.println("Beep"); } How many Beeps?
Lesson
A for loop repeats the lines inside its curly brackets. i starts at 0, the loop runs while i is less than the number, and i goes up by one each turn. Five turns means five Beeps from one println.
Demo
The tutor writes a loop in java/jv010/demo/Loops.java that prints Beep five times, runs it, then changes 5 to 12 and runs again: twelve Beeps, still one println.
Hands-on
In java/jv010/s3/Beeps.java write one loop that prints "Beep!" exactly seven times, then one println after the loop that says "Pixel is awake".
Explain
Why is there only one println but seven Beeps?
Check
Beeps.java prints seven Beep! lines then Pixel is awake — checked (T3):
seat_fileseat_run3.2Count down to blast-off5 minchecked · T3
Predict
for (int i = 3; i >= 1; i--) { System.out.println(i); } What prints?
Lesson
The counter i is a real box you can print. Start it high and use i-- to count down. The middle part says when to keep going; when it becomes false the loop stops.
Demo
The tutor prints the counter inside the loop from 1 to 5, then flips it into a countdown from 5 to 1 and adds println("Blast-off!") after the loop, running each version.
Hands-on
In java/jv010/s3/Countdown.java count down from 10 to 1, one number per line, then print "Blast-off!".
Explain
What makes the loop stop?
Check
Countdown.java prints 10 down to 1 then Blast-off! — checked (T3):
seat_run3.3The staircase6 minchecked · T3
Predict
"*".repeat(3) gives what?
Lesson
A loop and repeat make patterns. "*".repeat(i) is i stars; print it inside a loop where i grows and each row is one star longer: a staircase.
Demo
The tutor prints "*".repeat(i) for i from 1 to 5 and a staircase appears, then changes * to # and the start to 5 going down so the staircase flips upside down.
Hands-on
In java/jv010/s3/Stairs.java print a staircase of 6 rows: row 1 has one #, row 6 has six. Then print one row of six = signs as the floor.
Explain
Why does each row get longer?
Check
Stairs.java prints a six-row staircase and a floor — checked (T3):
seat_run3.4Show: the robot army6 minproven · T4
Predict
int n = Integer.parseInt(args[0]); and the loop runs i from 1 to n. If we type 4, how many robots?
Lesson
Put it together: a number from the command line, a loop that counts from 1 to that number, a line printed each turn with the counter in it, and one line after the loop that uses the number again.
Demo
The tutor builds the demo army: n from args[0], a loop printing "[o_o] Robot " + i, and after the loop n + " robots reported for duty", running it with 3 and then with 6.
Hands-on
In java/jv010/s3/Army.java read a number from args[0]. Print that many lines "[o_o] Robot 1", "[o_o] Robot 2" and so on, then "<n> robots reported for duty". Run it with 3, then with 5.
Explain
What would change if we typed 100?
Check
Army.java prints the robot army for any number — proven (T4):
seat_run
Session 4 · Robot moods
Four steps about choosing. if asks a question about a box and runs one set of lines when the answer is yes and another when it is no. Pixel gets grumpy when the battery is low, picks one of three moods, rolls a dice with a seed so the same roll comes back every time we ask for it, and finally becomes a mood machine driven by the command line. Live in the seat: a battery of 15 making Pixel grumpy, else if picking the middle mood, a seeded dice rolling the same numbers twice, and the mood machine tried with three batteries.
Lab Print Pixel's mood from a battery number typed when the program starts: Sleepy under 20, Fine from 20 to 79, Super at 80 or more, with a face for each mood. Session 4 show.
4 mini steps · ~23 min
4.1If the battery is low5 minproven · T4
Predict
int battery = 15; if (battery < 20) { println("Grumpy"); } else { println("Happy"); } What prints?
Lesson
if asks a yes-or-no question about a box, like battery < 20. If yes, the lines in the first curly brackets run. else holds the lines for no. Only one of the two ever runs.
Demo
The tutor writes the battery question in java/jv010/demo/Moods.java with Grumpy and Happy, runs it with battery = 15 and then 60, and shows that changing the number changes which words appear.
Hands-on
In java/jv010/s4/Low.java make int battery = Integer.parseInt(args[0]);. If the battery is under 30 print "Pixel is grumpy" and a frowning face row, else print "Pixel is happy" and a smiling face row.
Explain
Why did only one mood print?
Check
Low.java picks grumpy or happy from the battery — proven (T4):
seat_run4.2Three moods6 minproven · T4
Predict
if (b < 20) Sleepy; else if (b < 80) Fine; else Super. Battery 80 gives?
Lesson
else if adds a second question that is only asked when the first was no. You can chain as many as you need, and the last else catches everything that is left. Java checks from the top and stops at the first yes.
Demo
The tutor turns the demo into three moods with else if, runs it with 10, 50 and 95, and points at which question said yes each time, then tries 20 and 79 to show the edges.
Hands-on
In java/jv010/s4/Three.java read the battery from args[0] and print exactly one mood word: "Sleepy" under 20, "Fine" from 20 to 79, "Super" at 80 or more.
Explain
Why does 50 not print Super too?
Check
Three.java prints one of Sleepy, Fine, Super — proven (T4):
seat_run4.3Roll the dice6 minchecked · T3
Predict
new Random(7).nextInt(6) + 1 is run twice in two separate programs. Are the two numbers the same?
Lesson
Random makes dice rolls. nextInt(6) gives 0 to 5, so add 1 for a real dice. If you give Random a seed number, the rolls come out the same every time, which is handy for checking your game.
Demo
The tutor makes Random dice = new Random(7); and rolls three times in a loop, runs it twice to show the same three numbers, then changes the seed to 8 and gets different ones.
Hands-on
In java/jv010/s4/Dice.java read a seed from args[0], make new Random(seed), roll the dice 5 times in a loop and print each roll as "Roll: <number>". Then print "Pixel rolled 5 times".
Explain
Why do we add 1 to nextInt(6)?
Check
Dice.java prints five rolls between 1 and 6 from the seed — checked (T3):
seat_fileseat_run4.4Show: the mood machine6 minproven · T4
Predict
The mood machine prints a mood word and then a face. For battery 5, which face?
Lesson
A branch can hold more than one line. Put the mood word and its face rows inside the same curly brackets so the whole mood prints together. Three branches, three different faces.
Demo
The tutor shows the finished demo mood machine with a two-row face in each branch, runs it with 5, 50 and 99, then closes it so the learner builds their own faces.
Hands-on
In java/jv010/s4/Mood.java read the battery from args[0]. Print the mood word (Sleepy, Fine or Super, same rules as 4.2) and then two rows of a face for that mood. Sleepy eyes are "-", Fine eyes are "o", Super eyes are "O".
Explain
How did you make the face print with the right mood?
Check
Mood.java prints the mood and its face for any battery — proven (T4):
seat_run
Session 5 · Robot tricks
Four steps about teaching. A method is a trick with a name: write the lines once, then call the name whenever you want the trick. Pixel learns to wave, to beep a chosen number of times, to double a number and give the answer back, and finally keeps all the tricks in a trick book. Live in the seat: a wave method called three times, a beep method that takes a number, a method that returns a value printed by the caller, and three tricks in one file.
Lab Write Pixel's trick book: three methods — wave, beep with a number of times, and a trick that returns a number doubled — called in order from main with a number typed when the program starts. Session 5 show.
4 mini steps · ~23 min
5.1Teach a trick5 minchecked · T3
Predict
static void wave() prints "o/ hello". main calls wave(); wave(); How many hellos?
Lesson
A method is a named trick. static void wave() { ... } teaches it; wave(); does it. Teach once, call as often as you like. main is also a method: it is the one Java runs first.
Demo
The tutor adds static void wave() to java/jv010/demo/Tricks.java under main, printing an arm and a hello, calls it three times from main and runs it. Then the tutor changes the hello text once and all three change.
Hands-on
In java/jv010/s5/Wave.java write a method wave that prints two lines (an arm row and "Pixel waves!"), then call it three times from main.
Explain
Why did changing wave once change all three greetings?
Check
Wave.java defines wave() and calls it three times — checked (T3):
seat_fileseat_run5.2Tricks with inputs6 minchecked · T3
Predict
static void beep(int times) loops times and prints Beep. main calls beep(2); beep(3); How many Beeps?
Lesson
A trick can take an input in its round brackets: static void beep(int times). Inside, times is a box holding whatever the caller passed. Call beep(2) and beep(3) and the same trick does different amounts.
Demo
The tutor writes beep(int times) with a for loop inside, calls beep(1), beep(2), beep(3) from main, runs it, and points at how the number in the brackets lands in the times box.
Hands-on
In java/jv010/s5/Beep.java write beep(int times) that prints "Beep" that many times, then one line "---" after. From main call beep(2) and then beep(4).
Explain
What is times inside the method?
Check
Beep.java prints 2 Beeps, ---, 4 Beeps, --- — checked (T3):
seat_fileseat_run5.3Tricks that answer back6 minproven · T4
Predict
static int twice(int n) { return n * 2; } println(twice(21)); What prints?
Lesson
A trick can answer back. static int twice(int n) says the answer is a whole number, and return n * 2; hands it to whoever called. The caller can print it or put it in a box.
Demo
The tutor writes twice(int n), prints twice(5) and twice(21), then puts twice(4) in a box and prints the box, showing the answer travels back to main.
Hands-on
In java/jv010/s5/Answer.java write static int twice(int n) and static int addTen(int n). Read a number from args[0] and print "Twice: <answer>" and "Plus ten: <answer>".
Explain
What does return do?
Check
Answer.java returns twice and plus ten for any number — proven (T4):
seat_fileseat_run5.4Show: the trick book6 minproven · T4
Predict
main calls wave(); then beep(n); then prints twice(n). If n is 3, which comes first on the screen?
Lesson
A trick book is a file with several methods and a main that calls them in order. main reads the number from the command line and passes it to the tricks that need it.
Demo
The tutor shows the finished demo book: wave(), beep(int), twice(int) and a main that calls them with the number from args[0], runs it with 2 and 3, and closes the file.
Hands-on
In java/jv010/s5/Book.java write wave() (prints "Pixel waves!"), beep(int times) (prints Beep that many times) and twice(int n) (returns n times 2). main reads n from args[0], calls wave, beep(n) and prints "Twice: <answer>".
Explain
Why keep each trick in its own method instead of writing everything in main?
Check
Book.java runs three tricks in order for any number — proven (T4):
seat_fileseat_run
Session 6 · The Robot Show
Four steps to put on a show. We plan the scenes first, build each scene as its own method, add a finale countdown with a surprise on the last number, and run the whole show with a robot name and a number from the command line. Live in the seat: a plan written as comments, scene methods filled in one by one, a countdown that says Blast-off! at the end, and the finished show tried with two different names and numbers.
Lab The Robot Show: a program that takes a robot name and a number, prints a title with the name, a robot face, a row of that many robots, a mood from the number, a countdown from the number to 1, and "Blast-off, <name>!". The machine will try it with a new name and a new number. Session 6 show and course finale.
4 mini steps · ~23 min
6.1Plan the show5 minchecked · T3
Predict
A plan written as // comments inside main. What does Java do with those lines?
Lesson
Before building, write the plan. In main, write one // comment per scene: title, face, army, mood, countdown, blast-off. Each comment will become one method call. Java ignores comments, so nothing runs yet.
Demo
The tutor opens java/jv010/demo/Show.java with an empty main and writes six comment lines, one per scene, then runs it to show that a program of only comments prints nothing and is still fine.
Hands-on
Create java/jv010/s6/Show.java with a main that holds six // comment lines naming the scenes in order. Run it: it should print nothing and show no red message.
Explain
Why plan with comments before writing code?
Check
Show.java has six scene comments and runs clean — checked (T3):
seat_fileseat_run6.2Build the scenes6 minchecked · T3
Predict
The army scene is a method army(int n). Where does n come from when the show runs?
Lesson
Turn the first four comments into methods: title(String name), face(), army(int n) and mood(int n). Each one is a trick from an earlier session. main calls them in order with the name and number from args.
Demo
The tutor fills in title, face, army and mood in the demo, one method at a time, running after each so the show grows on screen, and keeps the comments above each call.
Hands-on
In java/jv010/s6/Show.java add methods title(String name), face(), army(int n) and mood(int n) from your earlier files, and call them from main with args[0] and Integer.parseInt(args[1]). Run with Pixel 3.
Explain
Which earlier step did each method come from?
Check
Show.java has the four scene methods and prints the first scenes — checked (T3):
seat_fileseat_run6.3The finale countdown6 minchecked · T3
Predict
Inside the countdown loop: if (i == 1) print "ONE!" else print i. For 3 the lines are?
Lesson
A loop and an if together: the countdown prints each number, but on the last one an if swaps the number for a surprise. == asks is exactly equal; one = would be putting into a box.
Demo
The tutor writes countdown(int from) in the demo with an if (i == 1) inside, runs it from 5, then adds the blast-off line after the loop with the robot name glued in.
Hands-on
In java/jv010/s6/Show.java add countdown(int from) that prints from down to 2 and then "ONE!", and in main after it print "Blast-off, <name>!". Run with Pixel 3.
Explain
What is the difference between = and ==?
Check
Show.java ends with the countdown and Blast-off — checked (T3):
seat_fileseat_run6.4Show: the Robot Show6 minproven · T4
Predict
The machine runs your show with Bolt 5 instead of Pixel 3. What must be true for it to pass?
Lesson
The finale: the whole show runs from the command line. Read your main from the top, run it with two different names and numbers, and fix anything that still says Pixel or 3 when it should not.
Demo
The tutor runs the demo show with Bolt 5 and Zippy 2, points at each scene following the new values, then closes it: the learner's show is their own.
Hands-on
Finish java/jv010/s6/Show.java: title with the name, the face, an army of n robots, the mood for n times 10 as a battery, the countdown from n, and "Blast-off, <name>!". Run with Pixel 3 and then with Bolt 5.
Explain
Which scene was the hardest, and what fixed it?
Check
The Robot Show runs for any robot name and number — proven (T4):
seat_fileseat_run
Outcome
By the end of the course the tutor's checks will have verified: a robot program for every step; six session shows — the badge, the settings card, the robot army, the mood machine, the trick book — and the final Robot Show, which runs correctly when the machine tries it with a new robot name and a new number.
Completion
No certificate for kids courses. When the last show is done, the guardian or teacher receives a completion card listing the sessions and the checks the machine ran. No streaks, no leaderboards, nothing shared.
Environment
A VS Code seat in the browser with Java 25 ready and offline; every program is one file run with java Robot.java, no project setup. Your work lives in java/jv010; the tutor's demo files live apart from yours and the tutor never edits your hands-on file while you are working on it.
Open Coding Tutor at codingtutor.agilesystemsoftware.com, pick JV010 from the course button in the chat and press Tutor me. Every lesson, demo and hands-on step is also published below.