Oracle 1z0-809 - Java SE 8 Programmer II
Which statement is true about the single abstract method of the java.util.function.Function interface?
Given:
and the code fragment:
What is the result?
Given the code fragment:
What is the result?
Given:
final class Folder {//line n1
//line n2
public void open () {
System.out.print(“Openâ€);
}
}
public class Test {
public static void main (String [] args) throws Exception {
try (Folder f = new Folder()) {
f.open();
}
}
}
Which two modifications enable the code to print Open Close? (Choose two.)
Which two statements are true about synchronization and locks? (Choose two.)
Given the code fragment:
What is the result?
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.getInt(“Idâ€));
16.System.out.println(“Description:“ + rs.getString(“Descripâ€));
17.System.out.println(“Price:“ + rs.getDouble(“Priceâ€));
18. System.out.println(Quantity:“ + rs.getInt(“Quantityâ€));
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 structure of the STUDENT table:
Student (id INTEGER, name VARCHAR)
Given:
public class Test {
static Connection newConnection =null;
public static Connection get DBConnection () throws SQLException {
try (Connection con = DriveManager.getConnection(URL, username, password)) {
newConnection = con;
}
return newConnection;
}
public static void main (String [] args) throws SQLException {
get DBConnection ();
Statement st = newConnection.createStatement();
st.executeUpdate(“INSERT INTO student VALUES (102, ‘Kelvin’)â€);
}
}
Assume that:
The required database driver is configured in the classpath.
The appropriate database is accessible with the URL, userName, and passWord exists.
The SQL query is valid.
What is the result?
Given the content of Operator.java, EngineOperator.java, and Engine.java files:
and the code fragment:
What is the result?
Given:
public class Counter {
public static void main (String[ ] args) {
int a = 10;
int b = -1;
assert (b >=1) : “Invalid Denominatorâ€;
int Ñ = a / b;
System.out.println (c);
}
}
What is the result of running the code with the –ea option?