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
Given three floating-point numbers x, y, and z, output x to the power of z, x to the power of (y to the power of z), the absolut
STALIN [3.7K]

Solution :

x = float_(input())

y = float_(input())

z = float_(input())

res1 = x**z

res2 = x**(y**z)

res3 = abs(x-y)

res4 = (x**z)**0.5

print('{:.2f} {:.2f} {:.2f} {:.2f}'.format(res1,res2,res3,res4))

Output is :

5.0

1.5

3.2

172.47 361.66 3.50 13.13

6 0
2 years ago
And what way do you mixed and market economy support the ideals of democracy​
PolarNik [594]
Mixed and market economies protect individuals' ability to make their own economic decisions.
5 0
3 years ago
Microsoft words spell checker
Degger [83]
The answer it is A i hope is good
3 0
3 years ago
What is the name of this tool and what can it be used for?<br> Thanks!!
Iteru [2.4K]
That is a corqet tool it is used for fixing tires
6 0
3 years ago
The way a particular application views the data from the database that the application uses is a.
masha68 [24]

The way a particular application views the data from the database that the application uses is a sub-schema.

<h3>What is Database?</h3>

A Database may be defined as a process of collecting data and information that is principally assembled for quick search and recoupment by a computer.

The sub-schema is the reasoning elucidation of that section of the database which is applicable and accessible to a specific application. This type of database is common to two or more applications.

Therefore, the sub-schema is the way through which a particular application views the data from the database that the application uses.

To learn more about Database, refer to the link:

brainly.com/question/26096799

#SPJ4

4 0
1 year ago
Other questions:
  • List and briefly defined categories of security services.
    8·1 answer
  • Which reading strategy refers to reading only the key words and phrases?
    13·2 answers
  • How many bit does four gigabyte has
    8·2 answers
  • Which would increase electric current? increasing the resistance increasing the size of the wire decreasing the voltage
    6·1 answer
  • If your DTP document contains watermarks on every page, where can you place them?
    10·1 answer
  • Which of the following is not a key component of a structure?
    12·1 answer
  • Which command tells the for loop what to count by?
    9·2 answers
  • when inserting a bibliography one choose from multiple ______ of bibliographies.[insert Bibliography]
    12·1 answer
  • How to install an older version of prettier on yarn
    9·1 answer
  • Which instruction is used to convert an integer value to float and push it onto the fpu stack?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!