This website is preserved for historical and scholarly reference and is no longer actively maintained.

QUIZ 29

October 31, 1997

Given the Java statement:

write a segment of Java code that will count the number of times the integer zero occurs in the array v. For example, if v was declared by

the count of the number of zeros would be 3. However, if v was declared by

the count of the number of zeros would be 2. Store the number of zeros in the integer variable count.


Use v.length to determine the number of entries actually in the array.



Return to Eleanor Hare's Home Page.

Return to Department of Computer Science Home page.