Introduction to Java - PowerPoint PPT Presentation

1 / 6
About This Presentation
Title:

Introduction to Java

Description:

The package java.util contains a family of collection classes. Here we ... Lets develop based on the hand-outs. WS 08/09. BA Mosbach / Referent Lars Vogel. 6 ... – PowerPoint PPT presentation

Number of Views:47
Avg rating:3.0/5.0
Slides: 7
Provided by: D416
Category:

less

Transcript and Presenter's Notes

Title: Introduction to Java


1
Introduction to Java Part 6
  • Informatik III

2
Collections
3
Collections
  • The package java.util contains a family of
    collection classes.
  • Here we will only mention one
  • ArrayList
  • Lists, e.g. ArrayLists can hold an unlimited
    number of objects
  • You can use method add(object) to add an object
    to an ArrayList

4
Collections
  • To define a ArrayList
  • ArrayListltTypgt var new ArrrayListltTypgt
  • The Typ is the type of objects this array should
    store, for example if the array should store
    objects of type Person
  • ArrayListltPersongt var new ArrrayListltPersongt
  • Easy for each loop available (see next slide)
  • Use method add(o) to add to the ArrayList
  • Use get(index) to get the index element (starts
    with 0)

5
Collections

6
Exercise
  • Lets develop based on the hand-outs
Write a Comment
User Comments (0)
About PowerShow.com