Question 116
Which action can be used to load a database driver by using JDBC3.0?
Question 117
Given the code fragments:
4. void doStuff() throws ArithmeticException, NumberFormatException,
Exception {
5. if (Math.random() >-1 throw new Exception ("Try again");
6. }
and
24. try {
25. doStuff ( ):
26. } catch (ArithmeticException | NumberFormatException | Exception e)
{
27. System.out.println (e.getMessage()); }
28. catch (Exception e) {
29. System.out.println (e.getMessage()); }
30. }
Which modification enables the code to print Try again?
4. void doStuff() throws ArithmeticException, NumberFormatException,
Exception {
5. if (Math.random() >-1 throw new Exception ("Try again");
6. }
and
24. try {
25. doStuff ( ):
26. } catch (ArithmeticException | NumberFormatException | Exception e)
{
27. System.out.println (e.getMessage()); }
28. catch (Exception e) {
29. System.out.println (e.getMessage()); }
30. }
Which modification enables the code to print Try again?
Question 118
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?
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?
Question 119
Given:

and the code fragment:

What is the result?

and the code fragment:

What is the result?
Question 120
Given:

and

Which interface from the java.util.functionpackage should you use to refactor the class Txt?

and

Which interface from the java.util.functionpackage should you use to refactor the class Txt?