I
IanH
I need to generate a message box with each of these random words but
cant figure out what im doing wrong, can anyone help?
import javax.swing.*;
public class random
{
public static void main (String args[])
{
String text[];
text = new String[5];
string increment;
int number = 0;
text[number++] = "Monday";
text[number++] = "Tuesday";
text[number++] = "Wednesday";
text[number++] = "Thursday";
text[number++] = "Friday";
increment = Math.floor(Math.random() * number);
JOptionPane.showMessageDialog(null, increment);
}
}
cant figure out what im doing wrong, can anyone help?
import javax.swing.*;
public class random
{
public static void main (String args[])
{
String text[];
text = new String[5];
string increment;
int number = 0;
text[number++] = "Monday";
text[number++] = "Tuesday";
text[number++] = "Wednesday";
text[number++] = "Thursday";
text[number++] = "Friday";
increment = Math.floor(Math.random() * number);
JOptionPane.showMessageDialog(null, increment);
}
}