Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

i'm trying to create a random color generator

807603Oct 22 2007 — edited Oct 22 2007
// create random color generator
String[]colors = {"RED", "ORANGE", "YELLOW", "GREEN", "BLUE", "INDIGO", "PURPLE"};

// create variable to store random color
int mycolorint = (int)(Math.random()*7);
String mycolor = colors[mycolorint];

// label axis
StdDraw.setPenColor(StdDraw.(mycolor));

what is wrong with this code?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 19 2007
Added on Oct 22 2007
4 comments
498 views