Question: Element Removal Given the Lists instruments and stringed instruments, remove all of the languages found in stringed instruments from instruments. Then, print instruments to the

Element Removal
Given the Lists instruments and stringed instruments, remove all of the languages found in stringed instruments from instruments. Then, print instruments to the console.
import java.io.*;
import java.util.*;
public class CodingQuestion {
public static void main(String[] args){
List instruments = new ArrayList<>();
instruments.add("Guitar");
instruments.add("Drums");
instruments.add("Flute");
instruments.add("Violin");
instruments.add("Saxophone");
instruments.add("Cello");
List stringedInstruments = new ArrayList<>();
stringedInstruments.add("Guitar");
stringedInstruments.add("Violin");
stringedInstruments.add("Cello");
stringedInstruments.add("DoubleBass");
stringedInstruments.add("Viola");
/***** DO NOT CHANGE THE CODE ABOVE THIS LINE *****/
// WRITE YOUR CODE HERE
}
}
STDOUT
Expected STDOUT
Non-stringedinstruments:[Drums,Flute,Saxophone]

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 Programming Questions!