| Author |
Help needed in Java
|
Deepak Lal
Ranch Hand
Joined: Jul 01, 2008
Posts: 507
|
|
I have a clarification in java.
Requirement:
1>Write a method in java such that it returns a number between 0 and 3 ?
2>Using the same above method as defined in step#1,generate a number between 0 and 7 ?
Please help me out to solve this .
--
Deepak Lal
|
When The Going Gets Tougher,The Tougher gets Going
|
 |
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14685
|
|
Please help me out to solve this .
What do you have so far ? (please read this)
|
[My Blog]
All roads lead to JavaRanch
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32830
|
|
And this. And this.
|
 |
Deepak Lal
Ranch Hand
Joined: Jul 01, 2008
Posts: 507
|
|
HI campbell and christophe,
i read your link.but i dont know how to proceed for this particualar problem.could you guide me please.?
|
 |
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12950
|
|
A method in Java that returns a number between 0 and 3:
Or is there more to the assignment than this? Did you mean a random number between 0 and 3? If so, then have a look at the API documentation for class java.lang.Math. It contains a method to generate random numbers. Or look at the documentation of class java.util.Random.
It sounds like a very simple exercise. Can explain in more detail what you don't understand about it?
|
Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
|
 |
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14685
|
|
Here is a part from this page that I'd like to draw your attention to :
We would much rather see you post your own code, working or not, and give you tips to help you get it working or point you toward resources that will help you to learn how to solve your problem using best practices.
|
 |
Deepak Lal
Ranch Hand
Joined: Jul 01, 2008
Posts: 507
|
|
Ok,
i will post my code and then please guide me to resolve it.
Thanks everyone.
--
Deepak Lal
|
 |
 |
|
|
subject: Help needed in Java
|
|
|