Collections: Difference between revisions

From Rosetta Code
Content added Content deleted
No edit summary
 
No edit summary
Line 6: Line 6:
ArrayList arrayList = new ArrayList();
ArrayList arrayList = new ArrayList();
arrayList.add(new Integer(0));
arrayList.add(new Integer(0));

==PHP==

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

Revision as of 21:07, 24 January 2007

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 ));