Introduction


Imagine you are building a supermarket management system in Java.

You create a class called SuperMarket to represent products.

Let's say every product has:


A name
A price


At first, everything seems easy.



SuperMarket product1 = new SuperMarket();

product1.name = "Rice";
product1.price = 200;






No problem.

Now let's...