private void saveStock(Product product) throws IOException, ClassNotFoundException{
       ArrayList<Product> products = new ArrayList<>();
        
       try
        {
            FileInputStream fis = new FileInputStream("myfile");
            ObjectInputStream ois = new ObjectInputStream(fis);
            products = (ArrayList) ois.readObject();
            ois.close();
            fis.close();
         }catch(IOException ioe){
             ioe.printStackTrace();
             return;
          }catch(ClassNotFoundException c){
             System.out.println("Class not found");
             c.printStackTrace();
             return;
          }
        for(Product tmp: products){
            System.out.println(tmp.toString());
        }
        products.add(product);
      
        try{
         FileOutputStream fos= new FileOutputStream("myfile");
         ObjectOutputStream oos= new ObjectOutputStream(fos);
         oos.writeObject(products);
         oos.close();
         fos.close();
       }catch(IOException ioe){
            ioe.printStackTrace();
        } 
      
        
    }