What a program actually is
Before writing a single line of code, let's make sure you understand what a program is. Not in a technical way — in a human way. Everything else builds from this.
A program is just a list of instructions that a computer follows, one at a time, in order. That's it. There's no magic. The computer does exactly what you tell it to do — no more, no less. If something goes wrong, it's because the instructions were wrong, not because the computer made a mistake.
You already write programs every day — you just call them recipes, directions, or checklists.
A recipe is a program
A recipe tells you: get two eggs, crack them into a bowl, add salt, whisk, pour into a hot pan, wait 2 minutes, flip. The instructions are in order. Each step depends on the previous one. If you skip step 3, the output (the omelette) is wrong. A computer program works exactly the same way.
The four things every program does
No matter how complex — a video game, a banking app, a social network — every program boils down to just four kinds of actions:
Take something in
Read from a keyboard, a file, a sensor, the internet. Something enters the program.
Do something with it
Calculate, compare, transform, sort. This is the logic — the brain of the program.
Remember it
Keep values in memory while the program runs, or save them to a file for later.
Show the result
Print to a screen, write to a file, send over a network. Something leaves the program.
Your Java Task Manager from the beginner course does all four: it reads your keyboard input, processes tasks (add, delete, complete), stores them in a file, and outputs a list to the screen.
The computer is very literal
This is the most important mindset shift for new programmers. Computers do exactly what you say — they don't infer what you meant, they don't fill in gaps, and they don't use common sense. If you tell it to do something impossible or contradictory, it crashes and tells you why.
This feels frustrating at first. Eventually it becomes one of your favourite things about programming — the computer is perfectly honest. If it's wrong, the instructions are wrong.
When a program seems to "know" something or "decide" something on its own, it's because a programmer wrote instructions that covered that case. The computer never surprises itself. Neither will you — you write the instructions, you know what they do.
Storing information
Programs need to remember things while they run. A variable is a named box in memory that holds a piece of information. You give the box a name, put something in it, and refer to it by name whenever you need it.
Variables are labelled boxes
Imagine a shelf of cardboard boxes. You write "player's score" on one box and put the number 0 in it. Every time the player earns points, you open that box and increase the number. The box exists in memory for as long as the program runs. Other parts of the program can look inside it whenever they need the score.
A variable has three parts
- A name — how you refer to it.
playerScore,userName,isLoggedIn - A type — what kind of thing is in the box. A whole number? Text? True/false?
- A value — the actual thing currently in the box. Can change over time.
Types of information
In real life you naturally know the difference between a number and a person's name. Computers need you to be explicit about this. Java has a few basic types:
Age, score, count
25, 0, -7, 1000000. No decimal point. Called int in Java.
Price, temperature
14.99, 3.14, -0.5. Has a decimal point. Called double in Java.
Names, messages
"Alice", "Hello!", "task-001". Any sequence of characters. Called String in Java.
On/off, yes/no
Only two possible values: true or false. Called boolean in Java.
For each piece of information below, which type fits best?
A variable's name never changes — playerScore is always playerScore. But the value inside it can change as many times as you want. That's why it's called a variable — its value varies.
Making decisions
A program that does the same thing every time isn't very useful. Conditions let your program ask a question and do different things depending on the answer. This is where logic lives.
A condition is a fork in the road
When you approach traffic lights: if the light is green, drive forward. Otherwise, stop. The light's colour is the condition. "Drive" or "stop" are the two possible actions. The program checks the condition and chooses the right path. Every second of every day, computers are doing millions of these.
The IF / OTHERWISE pattern
In plain English, a condition looks like this:
You can also chain multiple conditions:
Combining conditions
You can combine multiple conditions with AND or OR:
- AND — both must be true. "If it's raining AND I have an umbrella → go outside"
- OR — at least one must be true. "If it's Saturday OR Sunday → sleep in"
- NOT — flips it. "If NOT raining → no umbrella needed"
A cinema has different ticket prices. Drag the sliders and see which condition fires:
Repeating things
What if you need to do something a hundred times? Or an unknown number of times? Writing the same instructions over and over would be ridiculous. Loops let you repeat a block of instructions automatically.
Loops are like a "repeat until done" instruction
When you wash dishes, you don't write out: "wash plate 1, wash plate 2, wash plate 3...". You think: keep washing plates until the pile is empty. That's a loop. Check the condition (is there still a dirty plate?). If yes, wash one more. If no, stop.
Two kinds of loops
Almost every loop you ever write fits into one of two patterns:
"Do this 10 times"
You know in advance how many times to repeat. Print all 30 students. Send 5 reminder emails.
"Keep going until..."
You don't know how many repetitions. Keep asking for a password until it's correct. Keep reading lines until the file ends.
The danger: infinite loops
A loop that never stops is called an infinite loop. It happens when the condition you're checking can never become false. The program runs forever (or until your computer runs out of memory). This is a real mistake beginners make often. The fix: always make sure something changes inside the loop that will eventually make the condition false.
Watch a count loop run step by step. How many times?
Named instructions
What if you need to do the same set of steps in multiple places? You don't copy-paste them. You give that set of steps a name, and call it by name whenever you need it. This is a function — or in Java, a method.
Functions are like named recipes on a card
A chef doesn't rewrite the recipe for béchamel sauce every time they need it. They write it on a card called "make béchamel", and whenever a dish needs it, they follow that card. If the recipe ever changes, they update one card and every dish that uses it gets the update automatically. Functions work the same way.
Functions can take inputs and give back outputs
The most useful functions accept information (called parameters) and hand back a result (called a return value). Think of it like a vending machine: you put money in and press a button (inputs), and a snack comes out (output).
Why bother with functions?
- Write once, use many times — call the same function from anywhere
- Easy to fix — change the function in one place, fixed everywhere
- Easier to understand — a program made of well-named functions reads like plain English
- Easier to test — you can test each function independently
A real program isn't one giant list of instructions. It's dozens or hundreds of small, named, focused functions that call each other. Each function does one thing. Together they do everything. This idea — breaking big problems into small named pieces — is the most important skill in programming.
calculateTax(price) that you use in 40 places. The tax rate changes from 8% to 10%. How many places do you need to update?How a computer reads code
Understanding the order in which your instructions run — called the flow of execution — will save you hours of confusion when your program does something unexpected.
Top to bottom, left to right
By default, a computer reads your code exactly like you read this sentence: top to bottom, one line at a time, left to right. It starts at the first instruction, finishes it completely, then moves to the next. It doesn't jump ahead, skip around, or multitask.
This means the order of your instructions matters enormously. Swapping two lines can completely change what the program does — or break it entirely.
Click each step to see the computer execute it in order. Notice how the variable's value changes over time.
Three things that change the flow
Three structures break the "just go top to bottom" rule:
- Conditions — jump to a different set of instructions depending on a check
- Loops — go back up and repeat a section of instructions
- Function calls — jump to another named set of instructions, finish them, then come back
You already know all three of these. Now you know how they fit into the computer's reading order.
The most reliable debugging technique is to mentally (or literally, with a piece of paper) trace through your code line by line, tracking what each variable contains at each step. Most bugs become obvious within a few lines. Professional developers do this constantly.
score = score + 10score = 0What is
score at the end if it started at 5?From English to Java
You now understand every concept Java uses. This lesson is nothing new — it just shows you how the ideas you already know look when written in Java's particular notation.
Every language has its own spelling for the same concepts. Java's spelling can look intimidating at first — but the ideas underneath are what you just learned. Read the English version, then look at the Java version. They say the same thing.
You'll notice words like public static void in the Java versions. Don't worry about those yet — the beginner course explains each one carefully when you need it. For now, just notice that the core logic — the variable, the condition, the loop, the function — is exactly what you already learned.
while (livesRemaining > 0) {. Without knowing Java syntax, what does this mean in plain English?You're ready
You came in knowing nothing about programming. You leave this pre-course with the mental models every programmer uses. The beginner course will give those models their Java clothing — but the ideas are already yours.
What you now understand
A list of instructions
Computers follow them in order, literally. Input → Process → Store → Output.
Labelled boxes in memory
Hold information that can change. Have a type (number, text, true/false).
Decision forks
IF this → do that. ELSE → do something different. AND / OR for combining.
Repeat instructions
Count loops for a known number of times. Condition loops for "until done".
Named instructions
Write once, call anywhere. Take inputs, give back outputs. Break big problems into small pieces.
Top to bottom
Order matters. Conditions, loops, and function calls are the only things that change the flow.
A word of encouragement
Learning to program feels uncomfortable at first — not because you're not smart enough, but because it's a genuinely new way of thinking. Your brain is building new pathways. The discomfort you feel when something doesn't work isn't failure; it's learning happening.
Every professional developer you've ever heard of started exactly where you are right now. Every single one of them hit bugs they couldn't understand, wrote code that didn't work, and felt confused at 2am. What made them developers was that they kept going anyway.
The beginner course starts with exactly what you'd expect after this: Java's syntax for variables, printing output, and the structure of a program. You already understand what all of it means. Now you're just learning how Java spells it.
Read the error message — Java tells you exactly what went wrong and on which line. Trace through your code manually like a computer, line by line. Search the exact error message in quotes. Ask a question explaining what you expected to happen and what happened instead. These four steps solve 95% of beginner problems.