Given the content from lines.txt:
C -
C++
Java -
Go -
Kotlin -
and
What is the result?
Given the content from lines.txt:
C -
C++
Java -
Go -
Kotlin -
and
What is the result?
The code reads lines from a file, filters out lines that are equal to 'Java' (ignoring case), converts the remaining lines to uppercase, and collects them in a list. The input file consists of lines with content, none of which match 'Java' exactly (since they either have a '-' next to them or are completely different). Thus, none of the lines are filtered out due to ignoring case and not matching 'Java', and all lines are converted to uppercase. The resulting output will be the input lines with all characters in uppercase.
.filter(line -> !line.equalsIgnoreCase("JAVA") equalsIgnoreCase("JAVA") Two strings are considered equal ignoring case if they are of the same length and corresponding characters in the two strings are equal ignoring case. so all lines ARE included.
C is the correct answer, because data that is not equal to "JAVA" is filtered line by line from the file, so there will be no JAVA in the final output.
D tested JAVA # JAVA-
D is correct because s read line by line and JAVA has a - , and is not equals to JAVA. if no have that space or - remove java from the final list
Tested.
Answer: D
D is Correct TESTED