Collections: Difference between revisions
Content added Content deleted
No edit summary |
m (Making it a proper task page) |
||
Line 1: | Line 1: | ||
{{task}} |
|||
Collections are used to store objects and not primitive types. |
Collections are used to store objects and not primitive types. |
||
==Java== |
==[[Java]]== |
||
[[Category:Java]] |
|||
ArrayList arrayList = new ArrayList(); |
ArrayList arrayList = new ArrayList(); |
||
arrayList.add(new Integer(0)); |
arrayList.add(new Integer(0)); |
||
==PHP== |
==[[PHP]]== |
||
[[Category:PHP]] |
|||
$students = array(); |
$students = array(); |
||
array_push($students, array('name' => 'Joe Smith', 'age' => 21, height=> '72.5', gpa => 3.42 )); |
array_push($students, array('name' => 'Joe Smith', 'age' => 21, height=> '72.5', gpa => 3.42 )); |
Revision as of 21:23, 24 January 2007
Collections
You are encouraged to solve this task according to the task description, using any language you may know.
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 ));