subject

Consider the following method that is intended to test if all the strings in the arraylist start with an uppercase letter:

public static boolean capitalized(arraylist a) {
/* missing code */
}
which of the following could replace /* missing code */ so that the method works as intended?

i.

for (string s: a) {
if (s.(0) ! = s. charat(0)) {
return true;
}
}
return false;

ii.

for (string s: a) {
if (s.(0) ! = s. charat(0)) {
return false;
}
}
return true;

iii.

int flag = 1;
for (string s: a) {
if (s.(0) ! = s. charat(0)) {
flag = 0;
}
}
return (flag == 1);
ii only
iii only
i, ii and iii
i only
ii and iii

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 09:30
Facial expressions and gestures are examples of messages.
Answers: 3
question
Computers and Technology, 23.06.2019 21:00
Which task uses a simple parameter?
Answers: 1
question
Computers and Technology, 23.06.2019 23:30
What are "open-loop" and "closed-loop" systems
Answers: 1
question
Computers and Technology, 24.06.2019 06:30
For which utilities, if any, does the landlord pay?
Answers: 2
You know the right answer?
Consider the following method that is intended to test if all the strings in the arraylist start wit...
Questions
question
Mathematics, 23.07.2019 19:00
Questions on the website: 13722363