title: Updating the value of an object in an arraylist
body: <p>This problem has been bugging me for the last while.. i cant seem to be able to update the stock value of the vehicle that i'm selling. I understand how to search the array and locate the model that the user is looking for but i don't understand how to update the number of that specific model vehicle that are in stock. which is going to be stock - 1 after a purchase.</p>
  
  <p>I have both basic getters and setters for model and stock variables in the Vehicles superclass</p>
  
  <p>Any help is appreciate!</p>
  
  <p>Below is the method of purchasing a car from the driver class</p>
  
  <pre><code>     public void purchaseCar()
  {
      Scanner scan = new Scanner(System.in);
      String model, ans;
      System.out.println("****Car Purchase Page****");
      System.out.println("Enter the model of car you're looking to purchase");
      model = scan.nextLine();
      for (Vehicles v : list) {
          if (v.getmodel().equals(model))
          {
              System.out.println("Is this the model you want to purchase?");
              ans = scan.nextLine();
              if (ans.equals("yes")) {
                  System.out.println("Okay! Your order is being processed");
                  Vehicles.setStock() = stock - 1;
                      }
                  else { 
                      System.out.println("not working");
  
                  }
              }
          }
      }
  </code></pre>