Question 36
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-?
Question 37
Given the definition of the Empclass:
public class Emp
private String eName;
private Integer eAge;
Emp(String eN, Integer eA) {
this.eName = eN;
this.eAge = eA;
}
public Integer getEAge () {return eAge;}
public String getEName () {return eName;}
}
and code fragment:
List<Emp>li = Arrays.asList(new Emp("Sam", 20), New Emp("John", 60), New Emp ( "Jim", 51));
Predicate<Emp> agVal = s -> s.getEAge() > 50; //line n1
li = li.stream().filter(agVal).collect(Collectors.toList());
Stream<String> names = li.stream()map.(Emp::getEName); //line n2
names.forEach(n -> System.out.print(n + " "));
What is the result?
Question 38
Given the records from the STUDENTtable:
Given the code fragment:
Assume that the URL, username,and passwordare valid.
What is the result?
Question 39
Which statement is true about the DriverManagerclass?
Question 40
Given:
What change should you make to guarantee a single order of execution (printed values 1 -100 in order)?
