This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Java in General and the fly likes static Random Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "static Random" Watch "static Random" New topic
Author

static Random

Malhar Barai
Author
Ranch Hand

Joined: Aug 17, 2001
Posts: 399
hi all
to generate random password...i use
static Random rand = new Random();
but on compilation, it gives "illegal start of expression error"..
what cud be the pro..??

tia
MB


Malhar Barai
SOA & Java Book
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4181
    
  21

Try adding a public private or protected befor the static
Steve


Steve
Gopi Balaji
Ranch Hand

Joined: Jan 23, 2003
Posts: 84
Originally posted by Malhar Barai:
hi all
to generate random password...i use
static Random rand = new Random();
but on compilation, it gives "illegal start of expression error"..
what cud be the pro..??

tia
MB

Static variables cannot be defined within methods. They should be enclosed within classes only.
Is this the problem?
-GB.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: static Random