Announcements - PowerPoint PPT Presentation

About This Presentation
Title:

Announcements

Description:

Lecture 15: More Objects. Announcements & Review ... String[] names = {'McIntosh', 'Gala', 'Fuji'); max = 0; for (int i = 0; i names.length; i ) ... – PowerPoint PPT presentation

Number of Views:37
Avg rating:3.0/5.0
Slides: 6
Provided by: CSCF
Category:

less

Transcript and Presenter's Notes

Title: Announcements


1
Announcements Review
  • Last Time basic type arrays
  • // apple inventory
  • int inventory 10, 20, 30
  • String names McIntosh, Gala, Fuji)
  • max 0
  • for (int i 0 i lt names.length i)
  • System.out.println(namesi)
  • if (inventorymax lt inventoryi)
  • max i
  • System.out.println (Max inventory of
    namesmax of inventorymax)
  • Announcements
  • Lab 4 FlightReservation
  • Defining classes
  • Due
  • Thursday 10pm
  • Exam
  • 2/28 530-730pm
  • GEO 2.216

2
Operations Arrays
  • int appleInventory 3, 10, 99
  • appleInventory -gt

0 1 2
// operations on arrays of integers int i
inventory0 inventory1 30 inventory2 -
2 inventory2 inventory22 Arrays.sort(inve
ntory)
3
Visualizing Arrays
  • String appleNames "McIntosh", "Golden
    Delicious", "Granny Smith"
  • appleNames -gt

4
Strings vs Array of Strings
  • String myApples new String("apples")
  • String myApples -gt

0 1 2 3 4 5
// operations on string objects char c1
myApples.charAt(5) int position
myApples.indexOf(e) String sub
myApples.substring(0, 3) String sup
sub.concat(myApples) boolean same
sup.equals(sub)
// operations on string objects in an
array String names (Grapple, Red
Delicious, Fuji) char c1
names1.charAt(5) int position
names1.indexOf(e") String sub
names1.substring(0, 3) String sup
sub.concat(names1) boolean same
sup.equals(sub)
5
More Questions?
Write a Comment
User Comments (0)
About PowerShow.com