I\'ve got two arrays of question and answers
String questions[] = {
\"Q1?\",
\"Q2?\",
\"Q3?\"};
String answers[] = {
\"A1?\",
\"A2?\",
\"A3?\"}
Creating a class for holding both the question and answer together would be an easier and more OO solution:
class QuestionAnswerPair {
private final String question;
private final String answer;
public QuestionAnswerPair(String question, String answer) {
this.question = question;
this.answer = answer;
}
}
And then:
QuestionAnswerPair[] questions = new QuestionAnswerPair[] {
// Put questions here
};
Collections.shuffle(Arrays.asList(questions));