This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
sorry for my silly question but i'm a newbie and I think I've confused the .math thing
i want to make a sort program that chose random numbers to see how things work but it seemed that i confused it a bit
what i though is something like a for in the beginning like for (i=0; i <10 ; i++ then i though of using the try catch something like try then i've got troubles about the syntact of random.math and the a catch to hold exceptions and then a system print out with the number it was chosen.
is the way that i'm thinking correct i'm just trying to learn what I'm seeing in the book I bought but sometimes I need to discuss things
Look carefully at the System.out.println() statement, if i dont put Math.random() * 10in parentheses, i will get the same values consistently...Think about it...
Have A Nice Day !!!
Joined: Feb 25, 2005
I see that no try-catch is necessarily needed to do that simple thing (which although caused me troubles ) what I'm seeing for the first time is the 1 in the beggining what I also didn't do is to put the int in ()
If you need more help on this particular program, and when you need help in the future, you should post some code along with the verbal description of what you are trying to do. Code is a much more precise way of illustrating what you are having problems with. Also, when we try to help you, we can talk about the code in a much more precise way, whereas our help may be a bit vague when it comes to trying to decipher the verbal description on it's own. For more information about how to ask effectively questions, you should visit some of the links given in the related section in our FAQ. If you follow the advice given here, more people are likely to take the time to help you. Also, the turn around time will be minimized as many of the suggestions are an effort to help avoid any confusion during communication.