Given:
and the code fragment:
What is the result?
Given:
What is the result?
Given the code fragment:
List
Predicate
System.out.println(“Searching…”);
return n.contains(“red”);
};
colors.stream()
.filter(c -> c.length() >= 3)
.allMatch(test);
What is the result?
Given the code fragment:
What is the result?
Which statement is true about the single abstract method of the java.util.function.Function interface?
Given the code fragments:
and
What is the result?
Given:
and the code fragment:
Which two code fragments, when inserted at line n1 independently, enable the code to print TruckCarBike?
Given:
Item table
• ID, INTEGER: PK
• DESCRIP, VARCHAR(100)
• PRICE, REAL
• QUANTITY< INTEGER
And given the code fragment:
9. try {
10.Connection conn = DriveManager.getConnection(dbURL, username, password);
11. String query = “Select * FROM Item WHERE ID = 110”;
12. Statement stmt = conn.createStatement();
13. ResultSet rs = stmt.executeQuery(query);
14.while(rs.next()) {
15.System.out.println(“ID:“ + rs.getString(1));
16.System.out.println(“Description:“ + rs.getString(2));
17.System.out.println(“Price:“ + rs.getString(3));
18. System.out.println(Quantity:“ + rs.getString(4));
19.}
20. } catch (SQLException se) {
21. System.out.println(“Error”);
22. }
Assume that:
The required database driver is configured in the classpath.
The appropriate database is accessible with the dbURL, userName, and passWord exists.
The SQL query is valid.
What is the result?
Given the code fragments:
class Employee {
Optional
address;Employee (Optional
address) {this.address = address;
}
public Optional
getAddress() { return address; }}
class Address {
String city = “New York”;
public String getCity { return city: }
public String toString() {
return city;
}
}
and
Address address = new Address;
Optional
addrs1 = Optional.ofNullable (address);Employee e1 = new Employee (addrs1);
String eAddress = (addrs1.isPresent()) ? addrs1.get().getCity() : “City Not
available”;
System.out.println(eAddress);
What is the result?
Which two code blocks correctly initialize a Locale variable? (Choose two.)