Exam 1z0-809 All QuestionsBrowse all questions from this exam
Question 76

Given the code fragments:

class TechName {

String techName;

TechName (String techName) {

this.techName=techName;

}

}

and

List tech = Arrays.asList (

new TechName("Java-"),

new TechName("Oracle DB-"),

new TechName("J2EE-")

);

Stream stre = tech.stream();

//line n1

Which should be inserted at line n1 to print Java-Oracle DB-J2EE-?

    Correct Answer: B

    To print the concatenated string values of the 'techName' property from each 'TechName' object, we need to map each object to its 'techName' property and then print each mapped value. The correct code is 'stre.map(a-> a.techName).forEach(System.out::print);'. This maps each 'TechName' object to its 'techName' field and prints it, resulting in the output 'Java-Oracle DB-J2EE-'.

Discussion
adnano1234Option: B

The correct answer is B

asdfjhfgjuaDCVOption: B

B is the correct answer

steefaandOption: B

Correct B.

OhayouOption: B

Correct is B