7 Replies Latest reply on Apr 28, 2008 5:32 PM by 807591

    Zero Length Array Initialization

    807591
      Are all these the same, and if so, which is the the preferred one to use?

           private static final String[] ZERO_LENGTH_STRING_ARRAY_1 = new String[0];
           private static final String[] ZERO_LENGTH_STRING_ARRAY_2 = new String[] {};
           private static final String[] ZERO_LENGTH_STRING_ARRAY_3 = {};

      I think that the first is the most common way of initializing a zero-length array, but I am interested in
      other peoples opinions on this.

      Thanks in advance