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
Maru [420]
3 years ago
8

The following method is intended to remove all values from the ArrayList a that have the same value as val; however, this method

does not work correctly.public void removeValue(ArrayList a, int val) {int i;for (i = 0; i < a.size(); i++) {if (a.get(i) == val) {a.remove(i);}}}If the a contains 2 3 4 3 3 4 4 5 4 3 2 1 and val is equal to 4, then a should contain 2 3 3 3 5 3 2 1 after removeValue is invoked. What does a actually contain after removeValue is invoked? (2 points)1) 2 3 3 4 4 5 4 3 2 12) 2 3 3 3 4 5 3 2 13) 2 4 3 4 5 4 2 14) 2 3 3 3 5 3 2 15) 2 4 3 4 4 5 3 2 1
Computers and Technology
1 answer:
Alona [7]3 years ago
6 0

Answer:

ArrayList a contains [2, 3, 3, 3, 4, 5, 3, 2, 1]

Explanation:

Given

The removeValue method

Required

The content of ArrayList a, after the method is called

From the question, we understand that arraylist a is:

a= [2, 3, 4, 3, 3, 4, 4, 5, 4, 3, 2, 1]

val =4

The function fails when the value to be removed appear consecutively in the list.

4 appears in index 5 and 6 of the list. Only one of the 4's will be removed

So, the updated list will be: [2, 3, 3, 3, 4, 5, 3, 2, 1]

You might be interested in
Write a story, a tale, a biography or a diary.
antoniya [11.8K]
I will write a very short story, so I hope this helps a little

The processing of gold: A diary entry

April 5/2018

I am the worlds most precious metal. 
I am worth more than any silly diamond, and far more stronger than Iron. No one can come close to being as important as I.

I start as a tiny mineral, found underground where I spend my days perfecting myself. Most might find relatives of mine in water, buried among sand and dirt. Then we are put through the most rigorous of training until we are god.

Well, gold, but you know what I mean.

Once I am perfection, I will be sold among the masses of people.   I will be loved my all and crafted into everything. If I wanted, I could take over the world...a world of just gold, wouldn't that be magical?

Today I think I will be made into a ring, I hope I am not squeezed on some fat woman's finger.

I hope this helps a little, Cheers :)

6 0
3 years ago
Find the maximum value and minimum value in below mention code. Assign the maximum value to maxMiles, and the minimum value to m
Kobotan [32]

Answer:

Code works perfectly

Explanation:

There is nothing wrong with your program as it runs perfectly and displays the expected results.

You may need to compile with another compiler if you're not getting the required results.

I've added the source code as an attachment (unedited)

Download java
3 0
3 years ago
All air transportation carriers transport freight to some extent. True False
SCORPION-xisa [38]
TRUE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
4 0
3 years ago
Read 2 more answers
Each codec is stored within a file called a(n) ____ file.
frutty [35]
Im like 90% sure its a container file
5 0
3 years ago
What is the rotation used for the picture in Fig 17
mihalych1998 [28]

Answer:

hi, where is the picture

8 0
2 years ago
Other questions:
  • 2. The part of the computer that provides access to the Internet is the A. monitor. B. keyboard. C. system unit. D. modem.
    11·2 answers
  • A writing team wants to present the six-month sales figures for its company's 14 sales representatives in a report. Because mana
    11·1 answer
  • Design and implement a set of classes that define various types of reading material: books, novels, magazines, technical journal
    8·1 answer
  • Computer can do work very___​
    7·2 answers
  • The advancement of technology in our daily lives has changed how we interact with the world.
    10·1 answer
  • Please what do you guys think about this ?
    10·2 answers
  • Selection Sort List the resulting array after each iteration of the outer loop of the selection sort algorithm. Indicate the num
    10·1 answer
  • Using complete sentences post a detailed response to the following.
    11·1 answer
  • What's a big question or problem in the tech field you'd like to solve and why?
    6·1 answer
  • What changes could you make so that a message, "User input deemed invalid." during designing a simple calculator program for you
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!