i would like to make the question random, and when i give the answer to compare if they are correct answer or not?? can someone give me a little help with it?
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Random;
public class Main {
public static void main(String[] args) { String[] aa = { "question aa" }; String[] bb = { "question bb"}; String[] cc = { "question cc"}; String[] dd = { "question dd"}; String[] e = { "answer to question aa" }; String[] f = { "answer to question bb"}; String[] g = { "answer to question cc"}; String[] h = { "answer to question dd"}; // should be here the random question System.out.print("Enter your answer: "); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String userAnswer = null; try { userAnswer = br.readLine(); } catch (IOException ioe) { System.out.println("IO error trying to read your answer!"); System.exit(1); } System.out.println("Thanks for the answer, " + userAnswer);
}