Sams Teach Yourself Java™ in 24 Hours (Covering Java 7 and Android)

(singke) #1
ptg7068951

118 HOUR 9:Storing Information with Arrays


Workshop
If the brain were an array,you could test its lengthby answering each of the
following questions about arrays.

Quiz



  1. What types of information are arrays best suited for?
    A. Lists
    B. Pairs of related information
    C. Tr i v i a

  2. What variable can you use to check the upper boundary of an array?
    A. top
    B. length
    C. limit

  3. How many reindeer does Santa have,including Rudolph?
    A. 8
    B. 9
    C. 10


Answers



  1. A.Lists that contain nothing but the same type of information—strings,
    numbers,and so on—are well-suited for storage in arrays.

  2. B.Thelengthvariable contains a count of the number of elements in
    an array.

  3. B.Santa had “eight tiny reindeer,” according to Clement Clarke Moore’s
    “A V isit from St. Nicholas,” so Rudolph makes nine.

Free download pdf