Friday, May 21, 2010

What code do I need to write in Java to allow me to calculate the total items (classes) held in an array?

I have a program which allows me to add a class "Episode" to an array within the class "Series" and remove the class "Episode" from the array. What code do I need to total the amount of "Episodes" held within the array?

What code do I need to write in Java to allow me to calculate the total items (classes) held in an array?
If you have an array named episodes, all you need to do to find out how many elements are in it is this..





episodes.size();





this tells you the number of items in the array.


No comments:

Post a Comment