Given the code fragment:
Path currentFile = Paths.get(“/scratch/exam/temp.txt”);
Path outputFile = Paths get(“/scratch/exam/new.txt”);
Path directory = Paths.get(“/scratch/”);
Files.copy(currentFile, outputFile);
Files.copy(outputFile, directory);
Files.delete (outputFile);
The/scratch/exam/temp.txtfile exists. The/scratch/exam/new.txt and/scratch/new.txtfiles do not exist.
What is the result?
Given:
After which line can we insert assert i < 0 || values[i] <= values[i + 1]; to verify that the
values array is partially sorted?
Given the code fragment:
Path source = Paths.get(“/repo/a/a.txt”);
Path destination = Paths.get(“/repo”);
Files.move(source, destination); // line 1
Files.delete (source); // line 2
Assuming thesourcefile anddestinationfolder exist, what Is the result?
Given:
var fruits = List.of(“apple”, “orange”, “banana”, “lemon”);
You want to examine the first element that contains the character n. Which statement will accomplish this?
A bookstore's sales are represented by a list ofSaleobjects populated with the name of the customer and the books they purchased.
public class Sale {
private String customer;
private List
// constructor, setters and getters not shown
}
public class Book {
private String name;
private double price;
// constructor, setters and getters not shown
}
Given a list ofSaleobjects,tList, which code fragment creates a list of total sales for each customer in ascending order?