Here is a method that returns a random String (in the form of symbolic constants defined elsewhere):
public static String randString()
{
int testNum;
testNum = (int)(Math.random() * 5000);
if ( testNum > 4600 )
return BAR;
else if ( testNum > 3000 )
return CHERRIES;
else if ( testNum > 1200 )
return SPACE;
else
return SEVEN;
}
If this method were called from a program many times, the following lists the Strings that we would expect it to return, ordered from the most frequently returned Strings (top of list) to least frequently returned Strings (bottom of list),
(Check the one that fits this description.)
A. SPACE
CHERRIES
BAR
SEVEN
B. SEVEN
SPACE
CHERRIES
BAR
C. BAR
CHERRIES
SPACE
SEVEN
D. BAR
SEVEN
CHERRIES
SPACE
E. SPACE
CHERRIES
SEVEN
BAR
F. SEVEN
BAR
CHERRIES
SPACE