Collections: Difference between revisions

From Rosetta Code
Content added Content deleted
m (Making it a proper task page)
No edit summary
Line 1: Line 1:
{{task}}
{{task}}

Collections are used to store objects and not primitive types.
Collections are used to store objects and not primitive types.



Revision as of 21:23, 24 January 2007

Task
Collections
You are encouraged to solve this task according to the task description, using any language you may know.

Collections are used to store objects and not primitive types.


Java

  ArrayList arrayList = new ArrayList();
  arrayList.add(new Integer(0));

PHP

  $students = array();
  array_push($students, array('name' => 'Joe Smith', 'age' => 21, height=> '72.5', gpa => 3.42 ));