1 Reply Latest reply on Apr 2, 2008 10:44 PM by 807591

    Initiating static fields, and adding to a static array

      I have some fields that I declare in my class out of any methods like this:
      public class SObject
           public static final SObjectType NONE = new SObjectType("None", new None());
           public SObject()
      In the Class SObjectType I have an array that is the same way
      public class SObjectType
           public static ArrayList<SObjectType> sObjects = 
                new ArrayList<SObjectType>();
           public SObjectType(String name, SObject example)
      Then in the actual constructor of SObjectType I add the constructed SObjectType to this array sObjects, as seen here. But then when I use sObjects later it says that nothing was added.
      Why does this happen? Is it just impossible to add things to arrays when initializing fields like this?

      Edited by: happypigface on Apr 2, 2008 3:22 PM