File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes making mistake Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "making mistake" Watch "making mistake" New topic

making mistake

fozia inam

Joined: Nov 27, 2001
Posts: 4
hi,i have done the mistake sorry for it.
my problem is that i have to this assignment in java.lang
and ihave written acode but the output is not correct.the code is:

plz tell me where i m making mistake
(edited by Cindy to format "for" loop)

[This message has been edited by Cindy Glass (edited November 28, 2001).]
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

this thread continues from this one.
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

As i understand, you want an array of 20 random integers?
Obviously from your code there are other requirements (such as the range of the numbers and that they are unique)
Can you spell out the requirements for us and we can point out where you are going wrong.
Murtuza Thaver

Joined: Nov 05, 2001
Posts: 3
This might help
int a[]=new int[20];
for(int i=0;i<20;i++) {
//I was not sure what range u intended
//for this range is 11 < value < 55
a[i]=11 + (int)(Math.random() *55);

//u need to remove this as this is going to be
//true all the time

System.out.print(" " + a[i]);
I agree. Here's the link:
subject: making mistake
It's not a secret anymore!