Two things at once — what a thread is, and why your app needs them
Your food-delivery app shows a live map and updates the order status at the same time. Neither waits for the other. That is not magic — it is two threads, and this session is where you make your first one.
This session has not been authored yet
You have reached a real page, but an empty one. The deck for Class 21 is planned in full in the course knowledge document and is queued for authoring — nothing on this page is finished teaching content.
The roster underneath is the actual plan for this session, so you can see exactly what will land here.
What this class will cover
- Part-I openerThe orange arc across Classes 21–24, ending at deadlock and the Unit-2 close.
- Process vs threadWhat the operating system hands out, and what your program divides up inside it.
- Why an app needs more than oneThe live map and the order status, both moving, neither blocking the other.
- Creating a thread · extends ThreadThe first of the two ways, with a real running example.
- Creating a thread · implements RunnableThe second way, and why it is usually the better one.
- Which should you use?The honest comparison — inheritance budget, reusability, and what interviewers expect you to say.
- Worked exampleTwo threads running side by side, with genuine interleaved output that differs between runs.
- Activities + close cardHands-on thread creation, then the Class-21 close and the runway into the lifecycle.
Fair warning
From here on, running the same program twice can give you two different answers — and that is correct behaviour, not a bug. Getting comfortable with that is most of what Part I teaches.