One solution to ur prob :-
Store the Strings in an array ... ok ...
since there are 6 strings ... generator a random integer between 0 and 5 (inclusive) ... and get the Random String using the number as the index to the array !! ...
String array[] = {oranges, apples.....};
String randomString = array[java.math.random() * 5 ];
Originally posted by kumar abhay:
hi sir,
hope u r doin' fine .i m having some problems in the String data type of JAVA so plz help me out.The problem is given below:
Write a program to display a random choice from a set of six choice of (i.e breakfastApple,Orange,Grappes,Pineapple,Strawbery&Bannana)
i hope sir taht u will get me this answer asap.
i really appriaciate your concern
with regards
Kumar Abhay