Which should be inserted at line n1 to print Java-Oracl…

Given the code fragments:
class TechName {
String techName;
TechName (String techName) {
this.techName=techName;
}
}
and
List<TechName> tech = Arrays.asList (
new TechName(“Java-“),
new TechName(“Oracle DB-“),
new TechName(“J2EE-“)
);
Stream<TechName> stre = tech.stream();
//line n1
Which should be inserted at line n1 to print Java-Oracle DB-J2EE-?

Given the code fragments:
class TechName {
String techName;
TechName (String techName) {
this.techName=techName;
}
}
and
List<TechName> tech = Arrays.asList (
new TechName(“Java-“),
new TechName(“Oracle DB-“),
new TechName(“J2EE-“)
);
Stream<TechName> stre = tech.stream();
//line n1
Which should be inserted at line n1 to print Java-Oracle DB-J2EE-?

A.
stre.forEach(System.out::print);

B.
stre.map(a-> a.techName).forEach(System.out::print);

C.
stre.map(a-> a).forEachOrdered(System.out::print);

D.
stre.forEachOrdered(System.out::print);



Leave a Reply 4

Your email address will not be published. Required fields are marked *


smh

smh

B
prints, Java-Oracle DB-J2EE-

Berti John

Berti John

B is correct