APS Excellence in Physics Education Award
November 2019

Education Prize Logo
Science SPORE Prize
November 2011

NSF Logo
The Open Source Physics Project is supported by NSF DUE-0442581.

ArrayList post and replies

Return to the ArrayList thread
Login to post to this thread

ArrayList declaration
Apostolos Michaloudis
28 Posts

Hello!

I try to create an ArrayList<String>.

Can i make such a declaration at Variables?


Replies to ArrayList declaration

Re: ArrayList declaration -
Francisco Esquembre
228 Posts

You can. But you must qualify the class, as in java.utils.ArrayList

If you write the declaration using generics, as in,
java.utils.ArrayList
the variable line will turn pink, since the parser we use for checking the syntax does not support generics. But the compilation will work.

If you write just
java.utils.ArrayList
the variable line will not turn pink.

Paco



Re: Re: ArrayList declaration -
Apostolos Michaloudis
28 Posts

Thank you mr. Esquembre!

just a little correction if someone else sees it:

java.util.Arraylist

Post edited November 21, 2014 at 1:04 PM EST.



OSP Projects:
Open Source Physics - EJS Modeling
Tracker
Physlet Physics
Physlet Quantum Physics
STP Book