Write a code fragment that determines and prints the number of times the character 'z' appears in a String object called name.

What will be an ideal response?

```
int count = 0;
for (int index = 0; index < name.length(); index++)
if (name.charAt(index) == 'z')
count++;
System.out.println("The character \'z\' appears "
+ count + " time(s)");

```

Computer Science & Information Technology

You might also like to view...

A wireless access point performs a function similar to a switch

Indicate whether the statement is true or false

Computer Science & Information Technology

MC__________ , or pickling, converts complex object types, such as userdefined classes, to sets of bytes for storage or for tr answermission over a network.

a) Serialization. b) Ordering. c) Compiling. d) All of the above.

Computer Science & Information Technology