I recently fumbled into this code:
public static ArrayList<HelloGreeting> greetings = new ArrayList<HelloGreeting>();
static {
greetings.add(new HelloGreeting("hello world!"));
greetings.add(new HelloGreeting("goodbye world!"));
}
The question is why we use static here, can't we do just this:
public static ArrayList<HelloGreeting> greetings = new ArrayList<HelloGreeting>();
greetings.add(new HelloGreeting("hello world!"));
greetings.add(new HelloGreeting("goodbye world!"));
What benefit we get, space or time?