Hi!
I made a quiz program where you have to create a String q[] = {"what is the first letter?","a","b","c"};
and use this in addQuestion(q,2);
is it possible to use something like addQuestion( {"what is the first letter?", "a", "b", "c"},4);
?
If so, how?
addQuestion(new String[] { "What is the first letter?", "a", "b", "c" }, 4);
2 Likes
cansik
3
I would recommend to use variable arguments for the method you call:
void addQuestion(int number, String ... parts) {
...
}
This allows you to either throw in an array, or just strings:
addQuetion(3, "Really?", "Yes", "No");
1 Like