Re: Identifier expected error.



Art Cummings wrote:


"Lew" <lew@xxxxxxxxxxxxx> wrote in message
news:z7qdnRpTHe93b8HanZ2dnUVZ_h7inZ2d@xxxxxxxxxxxxxx
Art Cummings wrote:
Is there a way to have a static array in my OneStudent class? When I
try to do it, i'm getting an <identifier> expected error. If there is a
way to do it, can you tell me how?

Art:

READ THE TUTORIAL!

--
Lew

I promise to read it cover to cover as soon as this class is over Tuesday.
Lew, i'm trying to assign the result of an ArrayList insert to a variable,
like this....

String hold;
ArrayList nameList = new ArrayList();
hold = nameList.add(1, 56);

What is this supposed to do? The add() method of ArrayList is void, it does not
return a String. Also it accepts arguments of type (int, E) where E is the
class defined by generics to be the type of Object which the array list holds.
You haven't specified what type of object your ArrayList is supposed to hold so
it will hold any object without any type checking. You have managed to store an
Integer because of primitive type "boxing". But we've no idea if that is what
you really intended to do or not.

Please, do as Lew suggests and read the tutorials.


I'd like to be able to assign this to a double ultimately.

Assign what to a double? I see nothing in the above code which could be assigned
to a double.

Can you help me
with the syntax?

No, because I don't have a clue what you are trying to do.

--
Nigel Wade, System Administrator, Space Plasma Physics Group,
University of Leicester, Leicester, LE1 7RH, UK
E-mail : nmw@xxxxxxxxxxxx
Phone : +44 (0)116 2523548, Fax : +44 (0)116 2523555
.


Loading