Answer:
I think that the grade my teacher gave me on my test is wrong
Make a String ArrayList.Then write a Java method that swaps the first and last elements.
Answer:In order to swap elements of ArrayList with Java collections, we need to use the Collections.swap() method. It swaps the elements at the specified positions in the list.
Declaration −The java.util.Collections.swap() method is declared as follows
public static void swap(List <?> list, int i, int j)
where i is the index of the first element to be swapped, j is the index of the other element to be swapped and list is the list where the swapping takes place.
Explanation:
import java.util.*;
public class Example {
public static void main (String[] args) {
ArrayList<Integer> list = new ArrayList<Integer>();
list.add(10);//0
list.add(20);//1
list.add(30);//2
list.add(40);//3
list.add(50);//4
System.out.println("Original list : " + list);
Collections.swap(list, 4, 0); // swapping element at index 3 i.e. 50 and index 1 i.e. 10
System.out.println("List after swapping : " + list);
}
}
2. Which one of the following is the purpose of relating tables in a database?
A. To permit external data only to be viewed.
B. To allow data to be sorted before printing to a report.
C. To enable mathematical calculations to be carried out more efficiently.
D. To avoid duplication of data.
Answer:
D. To avoid duplication of data.
what keys would you use when selecting multiple files not listed together
To select multiple files that are not listed together is first arrange them in order by date or their names, so that they get listed together, then press CTRL A to select all and copy them into a separate file.
What is selecting multiple files?Selecting multiple files is choosing many files together at once. Many times we select multiple files at once, that save our time.
Thus, to select multiple files that are not listed together is first arrange them in order by date or their names, so that they get listed together, then press CTRL A to select all and copy them into a separate file.
Learn more about selecting files in computer
https://brainly.com/question/10894626
#SPJ1