[OCPJP] 集合与串流 5
What is the result? A. 1John2null B. 12 C. A NullPointerException is thrown at run time. D. A compilation error occurs.
MagicLen · https://magiclen.org
本站也提供繁體中文版。切換到繁體中文版
分类
认证考试的考古题与模拟题解析,包含 Linux 认证(LPIC-1、LPIC-2)与 Java 认证(OCAJP、OCPJP),每一题都附上答案与详细的解说。
共 888 篇文章
What is the result? A. 1John2null B. 12 C. A NullPointerException is thrown at run time. D. A compilation error occurs.
What is the result? A. Sam John Jim B. John Jim C. A compilation error occurs at line n1. D. A compilation error occurs at line n2.
Which statement is true? A. The program prints several values that total 55. B. The program prints 55. C. A compilation error occurs at line n1. D. The program prints several values whose sum exceeds...
Which two modifications enable the given code to compile? A. Nest the USCurrency enumeration declaration within the Coin class. B. Make the USCurrency enumeration constructor private. C. Remove the n...
Which code fragment can be inserted at line n1 to enable the code to print the content of the courses.txt file? A. List<String> fc = Files.list(file); fc.stream().forEach (s -> System.out.println(s))...
What is the result? A. 0 B. 1 C. A compilation error occurs at line n1. D. A compilation error occurs at line n2.
Which statement is true about java.util.stream.Stream? A. A stream cannot be consumed more than once. B. The execution mode of streams can be changed during processing. C. Streams are intended to mod...
Which code fragment, when inserted at line n1, enables the code to print the count of string elements whose length is greater than three? A. listVal.stream().filter(x -> x.length() > 3).count() B. li...
Assume that Projects contains subdirectories that contain .class files and is passed as an argument to the recDelete() method when it is invoked. What is the result? A. The method deletes all the .c...
What is the result? A. New York B. City Not available C. null D. A NoSuchElementException is thrown at run time.