1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Charra [1.4K]
3 years ago
5

How many times does the following loop execute?int upperCaseLetters = 0;String str = "abcdEfghI";boolean found = false;for (int

i = 0; i < str.length() && !found; i++){char ch = str.charAt(i);if (Character.isUpperCase(ch)){found = true;}}
Computers and Technology
1 answer:
damaskus [11]3 years ago
7 0

Answer:

Five times

Explanation:

Given the codes as follows:

  1.        int upperCaseLetters = 0;
  2.        String str = "abcdEfghI";
  3.        boolean found = false;
  4.        for (int i = 0; i < str.length() && !found; i++)
  5.        {
  6.            char ch = str.charAt(i);
  7.            if (Character.isUpperCase(ch))
  8.            {
  9.                found = true;
  10.            }
  11.        }

The for loop will stop when the first uppercase letter is found in the str. This condition is set in the for loop condition ( i < str.length() && !found)

Since the the first upper case letter is the fifth character in the given str, the for loop will run for five rounds. In the fifth round the condition in the if statement (Line 9) will be evaluated to true and then set the true value to found variable (Line 11). This will terminate the loop in the next iteration.

You might be interested in
Hi, I am from India. Our brainly platform isn't so good, many of 'em keep spamming questions that I ask. US platform seems much
olga_2 [115]
It seems like a great county to visit, with many great views and tourist spots throughout.
7 0
3 years ago
Which of the following will increase the level of security for personal and confidential information on a mobile device if the d
Soloha48 [4]
I believe is a and c.
8 0
3 years ago
Select the answer that best descibes what an opportunity cost is
TiliK225 [7]

Answer:

C.What you gain as a result of choosing one option versus another;a benefit.

Explanation:

6 0
3 years ago
To copy and paste from an excel workbook to a word document, you must first
Firlakuza [10]
Select the cells to copy. Then push CNTL+C to copy them. Next, click the cells you want to paste in. Finally, push CTRL+v to paste
5 0
3 years ago
Give examples of an outdated memory or storage device. what do you think is the main reason they are outdated?
omeli [17]

Answer:

floppy discs:

easily damaged, large compared to newer external storage drives, newer computers don't have a floppy disc drive

Explanation:

8 0
2 years ago
Read 2 more answers
Other questions:
  • The ________ model allows the owner of a resource to manage who can or cannot access the item. Owners maintain this access throu
    8·1 answer
  • Is brainly down? Cant search anything
    8·1 answer
  • What is an implicit benefit to Monetary Policy?
    6·1 answer
  • A company that manufactures machine parts order a new system that makes Products at ten times the speed of earlier machines. the
    13·2 answers
  • Define some everyday if else statements you use to determine action. What are the branches of your statement?
    12·1 answer
  • . What is a destructor and what is its purpose?
    5·1 answer
  • Zahra's softball team needs money for team T-shirts. The coach makes some fundraising suggestions, while team members brainstorm
    5·2 answers
  • What is Error Code: 232011
    11·2 answers
  • An outpatient provides the following id: barbara jones, birth date 8/15/63. should a specimen be collected for this lab order?
    11·1 answer
  • Cycle technology implemented a dibs initiative last year for one of the manufacturing sites. however, the initiative is not prog
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!