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]
4 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:
vekshin14 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
Do the pros of interpersonal communication via social media outweigh the cons? Explain.
JulijaS [17]
Well in my opinion is that yes they do. The ability to be able to communicate with others so far way really helps society advance towards the future. And i cant stress of how the benefits of being able to share ideas with well anyone is so wonderful.

I hope this helps.
6 0
3 years ago
Read 2 more answers
What is a feature of Print Preview?
Snezhnost [94]
Fit to page i believe
6 0
3 years ago
What does "FDDI" stand for in Technology?
Komok [63]
Pretty sure it's Fiber Distributed Data Interface
6 0
4 years ago
Read 2 more answers
Finish the sentence. If the IP address and MAC address are parameters of layer 3 and layer 2, respectively, a port number is a p
stepan [7]

Answer:

Layer 4

Explanation:

MAC address works at the data link layer (layer 2) of the OSI model. Mac address allows computers to uniquely identify themselves in the network

IP Address is a logical address that works at the network layer of OSI model (layer 3) (actually the IP layer of TCP/IP model).

The port number works at the transport layer of the OSI model (layer 4).The port number uses sequence number to send segments to the correct application thereby ensuring they arrive in the correct order.

7 0
3 years ago
How can earn more answer from brainly less than two minutes, please
Andrei [34K]
You have to answer other people’s questions.
6 0
4 years ago
Other questions:
  • Rose has a list of two columns of information separated by tabs. She wants to input this information into a table. What is the f
    15·2 answers
  • The opening of the throttle plate can be delayed as long as
    13·1 answer
  • The two ways to use the help menu is by searching of the contents or searching the _____
    13·2 answers
  • The ability to anticipate and determine upcoming driving hazards and conditions are adversely affected by stress.
    10·1 answer
  • Which one of the following provides an authentication mechanism that would be appropriate for pairing with a password to achieve
    13·1 answer
  • Define full-duplex. Group of answer choices term used to describe the networking device that enables hosts in a LAN to connect t
    9·1 answer
  • Which command should you select to track changes in a document?
    9·2 answers
  • Which of the following would allow for the QUICKEST restoration of a server into a warm recovery site in a case in which server
    10·1 answer
  • What is the purpose the wait block?
    10·1 answer
  • Many Java programs that you create will receive and process user input. In order to ensure that user input is accurate, you will
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!