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
vlada-n [284]
3 years ago
15

Consider the following method, inCommon, which takes two Integer ArrayList parameters. The method returns true if the same integ

er value appears in both lists at least one time, and false otherwise.
public static boolean inCommon(ArrayList a, ArrayList b)
{
for (int i = 0; i < a.size(); i++)
{
for (int j = 0; j < b.size(); j++) // Line 5
{
if (a.get(i).equals(b.get(j)))
{
return true;
}
}
}
return false;
}
Which of the following best explains the impact to the inCommon method when line 5 is replaced by for (int j = b.size() - 1; j > 0; j--) ?
A. The change has no impact on the behavior of the method.
B. After the change, the method will never check the first element in list b.
C. After the change, the method will never check the last element in list b.
D. After the change, the method will never check the first and the last elements in list b.
E. The change will cause the method to throw an IndexOutOfBounds exception.
Computers and Technology
1 answer:
sp2606 [1]3 years ago
6 0

Answer:

The answer is "Option b".

Explanation:

In the given code, a static method "inCommon" is declared, that accepts two array lists in its parameter, and inside the method two for loop is used, in which a conditional statement used, that checks element of array list a is equal to the element of array list b. If the condition is true it will return the value true, and if the condition is not true, it will return a false value. In this, the second loop is not used because j>0 so will never check the element of the first element.

You might be interested in
with the current computer development, explain 5th areas where computer is applied for the social economic dwvelopment in societ
AleksandrR [38]

Explanation:

just want points tbh but have a good day

7 0
3 years ago
Greg works outside. He is often found cutting grass and making the local park grounds look nice for guests.
kvasek [131]

Answer:

C Landscaper

Explanation:

From what I know about landscapers and from the description that makes the most sense.

3 0
3 years ago
Which option should you select to ignore all tracked changes in a document? To ignore all tracked changes in a document, you sho
Cloud [144]

Answer:

where is the options

Explanation:

4 0
2 years ago
Write a program that will add up the series of numbers: 99,98, 97...3.2.1. The program should print the running total as well as
Gekata [30.6K]

Answer:

result = 0

for i in range(99, 0, -1):

   result += i

   print(result)

Explanation:

7 0
3 years ago
VSphere Client is used to install and operate the guest OS. true or false
tangare [24]

Answer:

True

Explanation:

A guest Operating System (OS) is a secondary OS to the main installed OS which is the host Operating System (OS). Guest OS can either be a part of a partition or a Virtual Machine (VM). This guest OS is used as a substitute to the host OS.

vSphere Web Client can be installed by using a CD-ROM, DVD or ISO image which has the installation image to make a Virtual Machine (VM) functional.

5 0
3 years ago
Other questions:
  • Which Game Is Better &amp; Favorite For You?
    12·2 answers
  • strategy that is used to help improve the chances that your site will be found by search engines is known as search engine
    12·1 answer
  • Write a program that produces a Caesar cipher of a given message string. A Caesar cipher is formed by rotating each letter of a
    14·1 answer
  • Name three types of data stored on a computer’s hard disk
    11·1 answer
  • An Internet user has a need to send private data to another user. Which of the following provides the most security when transmi
    15·2 answers
  • What is 8 hours, 5 minutes, 22 seconds minus (-) 7 hours, 24 minutes, 37 seconds?
    6·1 answer
  • You have added a table to your web page consisting of two columns and five rows, including the header row. in the first header c
    13·1 answer
  • Sharon must give an informative presentation to a group of teenagers about cultivating earthworms for use in home gardening. Whi
    11·2 answers
  • Hey does anyone know the name of that movie where like this teenage girl is chilling at her house then there is an outbreak of s
    6·1 answer
  • How many domains are there in the classification system?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!