Concept Explanation
This lesson is a hands-on syntax drill built around the small rules that appear in almost every Java file: declaring variables, writing a simple condition, and sending output to the console. The focus is not speed. The focus is getting comfortable with braces, semicolons, and block structure so the code feels predictable. You will read a tiny decision-making example, adjust its values, and observe how small edits change the result.
Where to Put the Code
- Define color and position variables at the top.
- Create shape drawing or placement logic in the middle.
- Render output (print, canvas, SVG, or styled block) at the end.
Command Reference
- Identify each variable, its type, and the value currently stored in it.
- Run the condition once, then change one value to force the other branch.
- Explain why braces and semicolons matter in this example.
- Verify the output for both a passing case and a failing case.
Step-by-step Guide
- Read the code carefully and point out the int variable, the boolean variable, and the if statement.
- Run the program with the starter values and note which message appears.
- Change the score or submittedProject value to make the else branch run.
- Add one more output line that explains which condition failed or passed.
- Do a final syntax check: matching braces, semicolons, and readable indentation.
Practice Exercises
- Create a version that checks attendance in addition to score.
- Rewrite the condition with different variable names that are easier to understand.
- Test at least three combinations of values and record the output for each one.
Coding Challenges
- Build a simple eligibility check that uses two numeric values and one boolean flag.
- Refactor the code so someone new to Java can understand the condition at a glance.
Mini Practice Tasks
- Change one value and predict the output before running the program.
- Add a short comment above the if statement describing the rule.
- Write a one-line summary of what this program decides.
Common Mistake
Mixing x and y axes or using wrong coordinate origin causes shapes to appear in unexpected places.
Real-life Mini Challenge
Draw one square, one triangle, and one circle, then move X marker 2 steps right and 1 step down.