Correct Answer : Get Lastest Questions and Answer : Explanation: As you can see, in first stream we are reducing and summing all the course prices. However, we are not using result produce by first stream function. However, in second reduce function we are printing course which has highest feees.
Question : You have been given below code, what is the expected behavior?
Correct Answer : Get Lastest Questions and Answer : Explanation: This code is perfectly fine. We are comparing Welcome objects and sort them by their course name.
void java.util.Collections.sort(List list, Comparator super Welcome> c)
Sorts the specified list according to the order induced by the specified comparator. All elements in the list must be mutually comparable using the specified comparator (that is, c.compare(e1, e2) must not throw a ClassCastException for any elements e1 and e2 in the list). This sort is guaranteed to be stable: equal elements will not be reordered as a result of the sort. The specified list must be modifiable, but need not be resizable. Parameters: the class of the objects in the list list the list to be sorted. c the comparator to determine the order of the list. A null value indicates that the elements' natural ordering should be used.
public static void main(String[] args) { List listVal = Arrays.asList("HadoopExam", "QuickTechie", "Training4Exam", ".com"); System.out.println ( // line n1 ); } }
Which code fragment, when inserted at line n1, enables the code to print the count of string elements whose length is greater than 7? 1. listVal.stream().filter(x -> x.length()>7).count()
1. The Statement interface and its derived interfaces implement the AutoCloseable interface, hence Statement objects can be used with the try with- resources statement.
2. You can use PreparedStatement is used to execute stored procedures