Member-only story
How Java Supports Functional Programming | Complete Guide
Most beginners start with Imperative Programming, which follows a step-by-step approach — telling the computer HOW to do something by changing states and using loops.
On the other hand, Functional Programming focuses on WHAT to do rather than HOW to do it, avoiding state changes and side effects.
We will first see Imperative Programming — the traditional way of writing code that most programmers start with.
Imperative Programming
1. What is Imperative Programming?
Imperative programming is a step-by-step approach where we tell the computer HOW to perform a task by specifying each operation.
🔹 It uses loops, variables, and conditionals to modify the program’s state.
🔹 It focuses on explicit instructions rather than abstract concepts.
2. Real-World Example
Imagine you’re making a cup of tea.
In an imperative way, you follow these steps:
1️⃣ Boil water
2️⃣ Add tea leaves
3️⃣ Add sugar and milk
4️⃣ Stir and serve
You explicitly follow each step to get the final result.
Now, let’s see how this applies in programming.