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]
# 1
maybe, your parameter is so long for an integer, an integer only allow maybe 8 digits or less.... just maybe = )like 123456just try to shorten the numberMessage was edited by: vicious
viciousa at 2007-7-8 23:30:49 > top of Java-index,Java Essentials,New To Java...
# 2
I tried shortening it and it still didn't work it is saying it is finding void but it requires int. Do I have it right by having 900364417 in the parentheses after new Random and having 900364417 in the parentheses after setSeed?
dukefan44a at 2007-7-8 23:30:49 > top of Java-index,Java Essentials,New To Java...
# 3

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.

floundera at 2007-7-8 23:30:49 > top of Java-index,Java Essentials,New To Java...
# 4

> 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

kevljoa at 2007-7-8 23:30:49 > top of Java-index,Java Essentials,New To Java...
# 5
By the way, flounder, you probably saw this because the guy crossposted this exact question: http://forum.java.sun.com/thread.jspa?threadID=5131784And: http://forum.java.sun.com/thread.jspa?threadID=5131774
doremifasollatidoa at 2007-7-8 23:30:49 > top of Java-index,Java Essentials,New To Java...
# 6
Dirty double posting scumbag! Hope time runs out.
floundera at 2007-7-8 23:30:49 > top of Java-index,Java Essentials,New To Java...
# 7

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.

dukefan44a at 2007-7-8 23:30:49 > top of Java-index,Java Essentials,New To Java...
# 8
Bad luck baldy.If you are rude and ignorant to double post everywhere and can't even read the API to solve your problems, then programming probably isn't for you.
floundera at 2007-7-8 23:30:49 > top of Java-index,Java Essentials,New To Java...