i have a class with a constructor that returns objects. I'm adding these objects to a list but having trouble because every time i add a new element it replaces the previous ones with the current element that i am adding.
Here is the list and output:
    Objects a = new Objects("test1");
    Objects b = new Objects("test2");
    List<Objects> c = new ArrayList();
    c.add(a);
    c.add(b);
    System.out.println(c.get(0).getTest());
    System.out.println(c.get(1).getTest());
Here is the output:
test2
test2
Here is the class creating/returning the objects:
public class Objects
{
    public static String test;
    public Objects (String test)
    {
        this.test = test;
    }
      public String getTest()
      {
          return test;
      }
}
 
     
     
     
     
     
    