What is the cause of this error?
import java.util.Random;
public class MilkDelivery {
public static void main(String[] args) {
int delivery1, delivery2, delivery3, delivery4, delivery5;
Random eagleID = new Random(900364417);
delivery1=eagleID.setSeed(900364417);
System.out.println(delivery1);
I am trying to make the delivery1 equal a random number and it gives me this error message:
incompatible types found : void, required: int at line 21
[466 byte] By [
dukefan44a] at [2007-11-26 17:03:02]

Random eagleID = new Random(900364417);
delivery1=eagleID.setSeed(900364417);
The call to setSeed is pointless as you have already set the seed when you pass the value to the constructor. This is the second time I have seen this today. Are you two in the same class?
The setSeed method has a void return type. Therefore you cannot make that assignment.
If you want to assign a value to delivery1 then perhaps you should call one of the methods that return an int.
> import java.util.Random;
> public class MilkDelivery {
>public static void main(String[] args) {
> int delivery1, delivery2, delivery3, delivery4,
> delivery5;
>Random eagleID = new Random(900364417);
>delivery1=eagleID.setSeed(900364417);
>System.out.println(delivery1);
>
> m trying to make the delivery1 equal a random number
> and it gives me this error message:
> incompatible types found : void, required: int at
> line 21
Sorry, I'm rusty at this. setSeed returns type void. You are attempting to set your int, in this case delivery1 to a void. Please don't do that.
IHTH
Can someone tell me a method that will return an integer in the random class long seed? I am not good with API it confuses me. I looked at one that said nextInt but it had a long code like public ......
so i thought that was its own program I just want to make this work I am about to pull my hair out.