This is a very simple problem but im having serious problems!!!
Im making a simple program for uni in a basic java class and im needing to select a random string from an array.
this is my method code that i need help with..
public static void correct()
{
String[] reply = {"Well Done", "Excellent!", "Your Hot!", "Very good!", "Your On Fire!"};
JOptionPane.showMessageDialog (null, reply);
}
this gives me the whole array as the reply in the diologue box, i need it to give a random string as the reply.
Any help will be greatly appriecated!!
Im making a simple program for uni in a basic java class and im needing to select a random string from an array.
this is my method code that i need help with..
public static void correct()
{
String[] reply = {"Well Done", "Excellent!", "Your Hot!", "Very good!", "Your On Fire!"};
JOptionPane.showMessageDialog (null, reply);
}
this gives me the whole array as the reply in the diologue box, i need it to give a random string as the reply.
Any help will be greatly appriecated!!