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?
Given the code fragment:

Which code fragment, when inserted at line n1, enables the code to print /First.txt?
Given records from the Player table:

and given the code fragment:
try {
Connection conn = DriverManager.getConnection(URL, username, password);
Statement st= conn.createStatement(
ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
st.execute (''SELECT * FROM Player'');
st.setMaxRows(2);
ResultSet rs = st.getResultSet();
rs.absolute(3);
while (rs.next ()) {
System.out.println(rs.getInt(1) + '' '' + rs.getString(2));
}
} catch (SQLException ex) {
System.out.print(''SQLException is thrown.'');
}
Assume that:
The required database driver is configured in the classpath.
The appropriate database is accessible with URL, username, and password.
The SQL query is valid.
What is the result?
Which action can be used to load a database driver by using JDBC3.0?
Given the code fragment:
List
Predicate
int i = 0;
boolean result = s.contains (''pen'');
System.out.print(i++) + '':'');
return result;
};
str.stream()
.filter(test)
.findFirst()
.ifPresent(System.out ::print);
What is the result?