Consider the following method, which is intended to return true if at least one of the three strings s1, s2, or s3 contains the substring "art".; Otherwise, the method should return false.

public static boolean containsArt(String s1, String s2, String s3)
{

String all = s1 + s2 + s3;
return (all.indexOf("art") != -1);

}

Which of the following method calls demonstrates that the method does not work as intended?
Select one:
a. containsArt ("rattrap", "similar", "today")
b. containsArt ("start", "article", "Bart")
c. containsArt ("harm", "chortle", "crowbar")
d. containsArt ("matriculate", "carat", "arbitrary")
e. containsArt ("darkroom", "cartoon", "articulate")
a. containsArt ("rattrap", "similar", "today")

This is because the "art" is found as a combination of "similar" and "today". That is not as intended based upo

Respuesta :

There are several ways to manipulate strings; this includes concatenating and iterating through strings.

The method call that does not work as intended is: (a) containsArt ("rattrap", "similar", "today")

From the question, we understand that the method would return true if any of s1, s2 and s3 contain the string "art"

From the list of given options, none of the strings in the method call (a) contains "art". i.e. "rattrap", "similar" and "today" do not contain "art"

But the method call would still return true.

When "rattrap", "similar" and "today" are concatenated on the first line of the method, the new string  "rattrapsimilartoday" contains "art".

Hence, the method call that does not work as intended is: (a) containsArt ("rattrap", "similar", "today")

Read more about strings at:

https://brainly.com/question/16024994

                              Answer:

There are several ways to manipulate strings; this includes concatenating and iterating through strings.

The method call that does not work as intended is: (a) containsArt ("rattrap", "similar", "today")

From the question, we understand that the method would return true if any of s1, s2 and s3 contain the string "art"

From the list of given options, none of the strings in the method call (a) contains "art". i.e. "rattrap", "similar" and "today" do not contain "art"

But the method call would still return true.

When "rattrap", "similar" and "today" are concatenated on the first line of the method, the new string  "rattrapsimilartoday" contains "art".

Hence, the method call that does not work as intended is: (a) containsArt ("rattrap", "similar", "today")

Read more about strings at:

brainly.com/question/16024994