1. Process vs Thread

Process: A running program with its own memory/resources.

Thread: A unit of execution inside a process. Multiple threads can exist within one process and share its memory.

Example:

Process = Java Application
Threads = main thread, worker thread, etc.

Key difference:

Remember:

Process is the container; thread is the execution unit inside it.

2. What is a Thread?

A thread is a lightweight unit of execution inside a process.

Every Java application starts with a main thread that executes the main() method.

You can create another thread like:

Thread t = new Thread(() -> {
    System.out.println("Running");
});

t.start();

Here, t.start() starts a separate thread of execution.

Remember:

Process = container, Thread = execution unit inside it.