In C++, the code Card cards[20]; initializes 20 Card objects, whereas in Java, the code Card[] cards = new Card[20]; initializes an array that can hold 20 Card objects, but the Card objects aren't actually initialized. You have to do
for (int i = 0; i < cards.length; i++) {
cards[i] = new Card();
}
Is there any way to avoid having to do this in Java, similar to C++?