Question: This method gets an arraylist of Integers and a number(Integer) parameters then it returns an arraylist. It removes any instance of the number it gets

This method gets an arraylist of Integers and a number(Integer) parameters then it returns an arraylist.

It removes any instance of the number it gets from the arraylist.

for example:

romoveInst([1,1,2,3,1,4],1)

returns: [2,3,4]

romoveInst([3,4,3,3],4)

returns: [3,3,3]

Note: you might want to use either a while loop or for loop with if statement...

--- Please create Arraylist with only 6 integers and add data with using Scanner only.

--------------------------

import java.util.*; class Main {

//main method here public static void main(String[] args) { Scanner sc = new Scanner(System.in);

System.out.println("Enter the numbers for the list :"); System.out.println("Enter the number you want to remove from list :");

}//end main

public static ArrayList removeInst(ArrayList r, Integer n) { // your code here

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Finance Questions!