![]() |
![]() |
|
home—info—lects—labs—exams—hws
tutor/PIs—breeze (snow day)
Object120 + its docs—java.lang docs—java.util docs
- discuss hw09-soln.java [Files before: lect12c-playlist/;] - An array of Songs: Show the pictures involved with:
new Song[10]
Song[] album;
album = new Song[10];
album[0] = new Song(...);
album[1] = new Song(...);
...
// Write a loop to find the total play-time of all Songs:
double timeSoFar = 0.0;
for (int i=0; i < album.length; ++i) {
timeSoFar += album[i].length;
}
// N.B. Don't confuse album.length with album[i].length --
// entirely different beasts!
// (And, it was dumb luck those fields have the same name.
// Still, a common confusion is writing things like
// `album.isCopyrighted` or `i.artist`.)
|
home—info—lects—labs—exams—hws
tutor/PIs—breeze (snow day)
Object120 + its docs—java.lang docs—java.util docs
| ©2010, Ian Barland, Radford University Last modified 2010.Nov.19 (Fri) |
Please mail any suggestions (incl. typos, broken links) to ibarland |
![]() |