You can consider (and itβs not reality, but it kind of works like this) that primitives are something like this (I get to reality later ... so keep reading):
int.7, int.42 (will not compile), where int is the class (this is not the case), and 7 and 42 are public static final variables (they are not).
and that the lines are like this:
String "Hello", String. "world" (will not compile), where String is the class (it is) and "Hello" and "world" are public static final variables (they are not).
If my fake reality were true, you would need something like:
and
// also will not compile public class String { public final String "Hello" = new String("Hello); public final String "world" = new String("world); private final ??? data; public String(final ??? val) { data = val; } }
now you make an array like (still not compiling):
int[] array = new int[] { int.7, int.42 }; String[] array = new String[] {String."Hello", String."world" };
In the case of String, my alternate reality would be very stupid, since the String class cannot know in advance every possible String (for int it is possible).
So, we will get rid of public static final variables in String and do it instead:
String[] array = new String[] { new String("Hello"), new String("world") };
Now to reality:
When the java compiler, when it sees "Hello" or "world", it does something similar to "new String (" Hello ")" - it's a little smarter, so if you have "Hello" 20 times to a file, which contains only one copy (and some other things).
When you speak:
new int[100]; you get an array of 100 ints all set to 0. new String[100]; you get an array of 100 Strings all pointing to null. new Data[100]; you get 100 Dates all pointing to null.
Since the String and Date strings point to null, you need to allocate a new object for each of them. The reason you don't need to say βnewβ with String is because the compiler treats it specifically. The reason you don't need to say "new" with int is because it is a primitive, not an object.
So, a simple answer to your question: you need to assign a new date for each element of the array :-)