I have an static ArrayList which I can only access from a class ("Sale"). In that ArrayList I want to add items of the same class. How can I add them from the constructor?
I've done it this way and it doesn't work:
public class Sale{
     private static ArrayList<Sale> sales;
     private Buyer buyer;
     private Item item;
     public Sale(Buyer buyer, Item item){
          this.buyer=buyer;
          this.item=item;
          sales.add(this);
     }
.....
Thanks in advance, I'm starting programming in Java.
 
     
    