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
zlopas [31]
3 years ago
11

What output is produced by the following program segment? Why? (Recall that name.charAt(i) is the i-th character in the string,

name.)
String name;
int i;
boolean startWord;

name = "Richard M. Nixon";
startWord = true;
for (i = 0; i < name.length(); i++) {
if (startWord)
System.out.println(name.charAt(i));
if (name.charAt(i) == ' ')
startWord = true;
else
startWord = false;
}
Computers and Technology
1 answer:
vekshin13 years ago
8 0

Answer:

The output is:

R

M

N

Explanation:

The code snippet print the beginning letter of each word in the given name.

In the for loop snippet:

first the program check if startWord is true and it is true, then it print the value of the character at index 0. Then it check if value of character is empty. If it is empty, startWord is initialized to true else it is initialized to false.

The loop only print a character when the value of i are 0, 8 and 11 which are also the beginning character of a word.

You might be interested in
Write 8 tips for cyber safety
alina1380 [7]

Answer:

8 tips for cyber safety

1. Keep Personal Information Professional and Limited

2. Keep Your Privacy Settings On

3. Practice Safe Browsing

4. Make Sure Your Internet Connection is Secure. Use a Secure VPN Connection

5. Be Careful What You Download

6. Choose Strong Passwords

7. Make Online Purchases From Secure Sites

8. Be Careful What You Post

8 STEPS TO STOP YOUR CHILD’S CYBERBULLY

Resist The Urge To Respond Or Retaliate

Document The Bullying

Get Help

Block The Bully

Keep Passwords Secret

Be A Teammate

Approach The Parents

Support Your Child With A Stress-Free, Supportive Home

Explanation:

5 0
3 years ago
A merge is _____.
Aliun [14]
The process of combining information from a variety of sources
7 0
3 years ago
Read 2 more answers
In which area of the screen can features and functions of Word be accessed?
abruzzese [7]

Answer:

Toolbar

Explanation:

j don't know if you meant that instead of scroll bar, but tool bar is the answer

5 0
3 years ago
1) Which of the following would you NOT see on a Windows 10 Start menu?
Sati [7]
Task view

I hope this helps you :)
3 0
2 years ago
What report shows which types of mobile devices visited a website?.
Lerok [7]

Answer:

Technology > Network report. All traffic > Source/Medium report.

Explanation:

hope this helps

8 0
2 years ago
Other questions:
  • ________ is used to store programs and instructions that are automatically loaded when the computer is turned on.
    14·1 answer
  • Effective note-taking helps support<br><br> action.<br> distinction.<br> distraction.<br> retention.
    9·2 answers
  • Who was eqvtime tayaishvili?​
    13·2 answers
  • During the _____ of the systems development life cycle (SDLC), an information system is operating, enhancements and modification
    9·1 answer
  • •Should other states wait to see if the high-speed rail system works well before starting their own plans for similar systems?
    15·1 answer
  • Select four tasks associated with operating system maintenance. Cleaning inside the computer Defragmenting the hard drive Deleti
    11·1 answer
  • Now the y0utube home screen is gone
    13·2 answers
  • When a Select Case statement executes, the value of the test expression is compared with the values that follow each of the ____
    7·1 answer
  • My phone takes forever to load the ads, does anyone else have this problem? Is there a way to fix it? I’ve tried getting another
    12·2 answers
  • Which of the following is an operating system?<br> MacBook Air<br> Windows 10<br> Dell
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!