Is it right to return null,if object not found in array,I think it not usefull,or how can do right?
public Product FindByProductName(Product [] products,String productName){
            for(Product item:products)
                if(item.GetProductName().equals(productName))
                    return item;
            return null;
        }
Not usefull beacause I must use that function like this
Product result = products.FindByProductName(productsArray, "someName");
        if(result == null)
            System.out.print("Object not found!");
        else result.Show();
public void Show() {
        System.out.println("Название продукта = " + this.GetProductName() + ";" + " Код продукта = " + this.GetProductCode() + ";" + " Марка металла = " + this.GetBrandMetal() + ";" + " Вес продукта = " + this.GetWeightOfProduct() + ";");
    }
 
    