Master the core of Java, from logical steps to machineย execution.
Can you guide the robot to its morning coffee?
Add steps to your algorithm.
Algorithm is empty.
Select commands to start.
A precise, step-by-step procedure for solving a specificย task.
A translator can turn unfamiliar signals into a shared language.
Java source is checked before it becomes .class bytecode.
Checks Before Running
A compiler checks source code for some errors before the program runs.
Fix Before Running
Fix every compiler-detected error before the program can run.
01101001
11001110
10101011
00000001
11110000
10101010
01010101
11001100
10001000
01110111
Even the best programmers make mistakes โ the key is knowing what kind.
Every bug you meet will be one of these three.
Syntax Error
Breaks Java's grammar, so the code will not compile.
Logic Error
Runs normally, but produces the wrong result.
Runtime Error
Starts successfully, then fails while running.
Identify the error family from the scenario.
Question
You're filling out an online registration form. You type your email as "studentgmail.com" without the "@" symbol and click Submit. The form immediately highlights the email field in red, displays "Invalid format," and refuses to proceed โ nothing gets saved or processed.
Which error family does this describe?
Identify the error family from the scenario.
Question
You're playing a mobile game. Halfway through the third level boss fight, the game suddenly crashes to the home screen with no warning.
Which error family does this describe?
Identify the error family from the scenario.
Question
Your friend follows a pancake recipe step by step โ mix, pour, flip โ and the pancakes come out looking perfect. But after the first bite you realize they used salt instead of sugar. Every instruction was followed correctly, and nothing burned or broke.
Which error family does this describe?
Every Java journey starts with a class and a main method.
The 'Containers' of Messages
Communicating with the Machine Console
print = Stay on line
println = Message + Enter
What exactly is printed?
A backslash changes the meaning of special characters in a string.
New Line
Moves the cursor to the next line
Double Quote
Prints a quote inside a string
Backslash
Prints a single backslash character
What exactly is printed?
Which Java statement produces this output?
Snacks, discounts, and leftovers can all change the final basket.
The Building Blocks of Java Calculation
Addition
5 + 2 โ 7
Subtraction
5 - 2 โ 3
Multiplication
5 * 2 โ 10
Division
5 / 2 โ 2
Integer Division!
Modulo
5 % 2 โ 1
Remainder
Java evaluates grouped and higher-priority operations before lower-priority ones.
Press Next to evaluate one rule at a time.
In Java, dividing two integers always results in an integer.
What is the value of this expression?
What is the value of this expression?
What is the value of this expression?
What is the value of this expression?
What is the value of this expression?
The machine simply skips them entirely.
Complete it on time and submit it before the deadline.
Check what comes next and arrive ready.
Key takeaways from this lesson.
Error Types
Syntax stops compilation, logic gives a wrong result, and runtime crashes during execution.
Standard Framework
Every program needs a class and a main method to run.
Output Mechanics
print stays on the same line, while println adds a new line after.
Escape Sequences
Use \n for new lines and \" to print double quotes inside strings.
Integer Division
Dividing whole-number values truncates the decimal: 5 / 2 = 2.
Comments
Use // or /* */ for people; the compiler ignores both.