Write a code fragment that determines how many times the character 'A' appears in a String object called name.

What will be an ideal response?

```
int countA = 0;
for(int i = 0; i < name.length(); i++)
if(name.charAt(a) == 'A')
countA++;

System.out.println("A appears " + countA + " times in " + name + ".");
```

Computer Science & Information Technology

You might also like to view...

The _______ is the Windows menu that contains Startup Repair, which can be used to fix the computer when Windows does not boot properly

Fill in the blank(s) with correct word

Computer Science & Information Technology

NIDPSs can reliably ascertain whether an attack was successful.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology