that java explained
that java explained
DCIT 25
BSIT – 2B
Asynchronous Activity #4
1) Write a java program that appends a specified color to the end of the list of colors. The
output should look like this:
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
Output:
2) Write a java program that iterates through all the colors in the list of colors. The output
should look like this:
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
Output:
Red
Orange
Yellow
Green
Blue
Indigo
Violet
3) Write a Java program that inserts elements into the list of flowers at the first and in last
position. The output should look like this:
import java.util.ArrayList;
import java.util.List;
flowers.add(0, "Carnation");
flowers.add("Sunflower");
Output:
4) Write a Java program that removes the elements that are not even numbers from the list
of numbers (Your code should be flexible). The output should look like this:
import java.util.ArrayList;
import java.util.List;
Output:
5) Write a Java program that checks if a particular student exists from a list of students
(Your code should be flexible, the output should be open for changes). The output
should look like this:
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
Output:
To change the student to be checked, simply change the value of the studentToCheck
variable to another name. For example:
This way, the output will change according to the provided name.