Course Hero Logo

New question 147 given the code fragment liststring

Course Hero uses AI to attempt to automatically extract content from documents to surface to you and others so you can study better, e.g., in search results, to enrich docs, and more. This preview shows page 18 - 21 out of 35 pages.

NEW QUESTION 147Given the code fragment:List<String> nL = Arrays.asList(“Jim”, “John”, “Jeff”); Function<String, String> funVal = s -> “Hello : “.contact(s); nL.Stream().map(funVal).peek(System.out::print); What is the result?A. Hello : Jim Hello : John Hello : JeffB. Jim John JeffC. The program prints nothing.D. A compilation error occurs.Answer:C
NEW QUESTION 148Given:class RateOfInterest {public static void main (String[] args) { int rateOfInterest = 0;String accountType = “LOAN”; switch (accountType) {case “RD”; rateOfInterest = 5; break;case “FD”; rateOfInterest = 10; break;default:assert false: “No interest for this account”; //line n1}System.out.println (“Rate of interest:” + rateOfInterest);}}and the command:java –ea RateOfInterest What is the result?B
NEW QUESTION 153Given the code fragment:The Leader of IT Certificationvisit -
100% Valid and Newest Version 1Z0-809 Questions & Answers shared by Certleader (155 Q&As)What is the result?D
NEW QUESTION 156Given the code fragment:What is the result?C
NEW QUESTION 159Assume customers.txt is accessible and contains multiple lines. Which code fragment prints the contents of the customers.txt file?A. Stream<String> stream = Files.find (Paths.get (“customers.txt”)); stream.forEach((String c) -> System.out.println(c));B. Stream<Path> stream = Files.find (Paths.get (“customers.txt”)); stream.forEach( c) -> System.out.println(c));C. Stream<Path> stream = Files.list (Paths.get (“customers.txt”)); stream.forEach( c) -> System.out.println(c));D. Stream<String> lines = Files.lines (Paths.get (“customers.txt”)); lines.forEach( c) -> System.out.println(c));Answer:A
NEW QUESTION 163Given the code fragment:Which statement can be inserted into line n1 to print 1,2; 1,10; 2,20;?B
NEW QUESTION 168Given:The Leader of IT Certificationvisit -
100% Valid and Newest Version 1Z0-809 Questions & Answers shared by Certleader (155 Q&As)

Upload your study docs or become a

Course Hero member to access this document

Upload your study docs or become a

Course Hero member to access this document

End of preview. Want to read all 35 pages?

Upload your study docs or become a

Course Hero member to access this document

Term
Fall
Professor
Jaskaran
Tags
Madrid Metro, Shanghai Metro, Certleader

Newly uploaded documents

Show More

Newly uploaded documents

Show More

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture