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...

A ________ IP address is an IP address assigned by an Internet service provider each time one of its clients connects to the Internet

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

Which of the following refers to the abuse of electronic messaging systems to randomly or indiscriminately send unsolicited bulk messages?

a. phishing b. spamming c. phreaking d. shoulder surfing

Computer Science & Information Technology

How is the Registry organized?

A. As a tree structure B. As a flat structure C. As a relational structure D. As a peer structure

Computer Science & Information Technology

Which command is used to validate a lookup file?

A. | lookup products.csv B. inputlookup products.csv C. | inputlookup products.csv D. | lookup_definition products.csv

Computer Science & Information Technology