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
kogti [31]
3 years ago
5

Create a method removeEvens that removes all even elements from an ArrayList of Integers. The method should also print all the r

emaining items in the ArrayList.
Once the method is created, call it on the existing ArrayList in the main method.
Someone please help im really confused
Computers and Technology
1 answer:
Tema [17]3 years ago
8 0

Answer:

import java.util.ArrayList;

public class Odds {

public static void main(String[] args) {

ArrayList<Integer> odds = new ArrayList<Integer>();

for (int index = 1; index < 101; index++) {

odds.add(index);

}

removeEvens(odds);

System.out.println(odds);

}

public static void removeEvens(ArrayList<Integer> array) {

for (int i = 0; i < array.size(); i++) {

if (array.get(i) % 2 == 0) {

array.remove(i);

i--;

}

}

}

}

You might be interested in
Mark for review (Will be highlighted on the review page) 11. A feature in Excel that allows you to graphically display in a sing
Tresset [83]
A feature in Excel that allows you to graphically display in a single cell the trend across a range of cells is called a sparkline.
8 0
4 years ago
When creating a query using the query design command, first you must ____?
Doss [256]

You must first locate the queries group on the create tab. This tab contains the commands used to create queries. MS Access will switch itself to the query design view. A show table dialog box will appear and you will be able to select a table you would want to run a query on.






5 0
4 years ago
What is computer hardware / software​
Pavel [41]

Answer: <u>Computer hardware is any physical device used in or with your machine, like for example, a mouse, or a keyboard.</u> Computer software is a collection of programming code installed on your computer's hard drive it can process billions of data and inputs through this.

Hope this helps!

5 0
3 years ago
Why don't I have friends?
Papessa [141]

Answer:

maybe you do not ask for them i will be your friend.

Explanation:

7 0
3 years ago
Read 2 more answers
Manipulating an experiment so that you get desired data in research is an example of​
andrew11 [14]
Influencing independent variable(s)
4 0
3 years ago
Other questions:
  • What is the utility of a lever?
    11·2 answers
  • Traffic collisions are among the top killers of children in America.
    13·1 answer
  • How many Iron molecules are in the compound Fe4O2?
    15·2 answers
  • What connectors are available for components to be connected externally to the motherboard
    12·2 answers
  • Que es tarjeta madre resumen porfa
    13·2 answers
  • The identification of the technology management framework contain?
    6·1 answer
  • A user finished working on a computer in the lab. What should the user do so
    15·1 answer
  • ________________, _______________ and ___________ are what you see when you open Excel
    14·2 answers
  • Why does brainly want me to PAY or watch ads<br> i hate doing that
    9·1 answer
  • Differentiate between patent and copyright.
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!