A string array literal can be written as:
new String[] {"Hellow world", "Bo mundo", "Hola Mundo" }
In declarations you can avoid the 'new String[]' stuff, because java infer the type, but this is not the case. So, if you want to create a new question:
Question question = new Question(1, "2 + 2 = ?", new String[] {"1", "2", "42"});
Anyway, another functionality you could use to reduce such a verbosity is to use '...'. For example, if you write the following instead
public Question(int id, String question, String... answers) {
this.id = id;
this.question = question;
this.answers = answers;
}
answers will still be an array of Strings, but you can call Question's constructors as a variable arguments function:
Question question = new Question(1, "2 + 2 = ?", "1", "2", "42"});
Where all the parameter after question are part of the answers array.