You don't have different product contents, you only have one:
package prod;
public class Product {
static String product;
public void putProduct(String product) {
Product.product = product;
Notice the static
: All products (Product
objects) share the same content. So when your producer produces a new product
Product p = new Product();
p.putProduct("Consumer product");
you set the content for all products. So it may seem that the consumers get the same product but that is not quite correct. Every consumer gets a different object of type Product
but all products share the same content. By creating the new product you change the content of existing products also. When outputting you can't notice the difference because you only use an artificial index and the shared content (would you use a object specific value like `hashCode´ you could see that those are different objects).