Which three objects must a vendor provide implementations in its JDBC driver?
Given the following code fragment:
public class Calc {
public static void main (String [] args) {
//* insert code here Line ** System.out.print("The decimal value is" + var);
}
}
Which three code fragments, when inserted independently at line **, enable the code to compile/
What are two benefits of a Factory design pattern?
Given:
import java.util.*;
public class StringApp {
public static void main (String [] args) {
Set <String> set = new TreeSet <> ();
set.add("X");
set.add("Y");
set.add("X");
set.add("Y");
set.add("X");
Iterator <String> it = set.iterator ();
int count = 0;
while (it.hasNext()) {
switch (it.next()){
case "X":
System.out.print("X ");
break;
case "Y":
System.out.print("Y ");
break;
}
count++;
}
System.out.println ("\ncount = " + count);
}
}
What is the result?
Given the code fragment:
String query = "SELECT ID FROM Employee"; \\ Line 1 try (Statement stmt = conn.CreateStatement()) { \\ Line 2 ResultSet rs = stmt.executeQuery(query); \\ Line 3 stmt.executeQuery ("SELECT ID FROM Customer"); \\ Line 4 while (rs.next()) { \\process the results System.out.println ("Employee ID: " + rs.getInt("ID") ); } } catch (Exception e) { system.out.println ("Error"); }
Assume that the SQL queries return records. What is the result of compiling and executing this code fragment?
Given:
private static void copyContents() {
try (
InputStream fis = new FileInputStream("report1.txt");
OutputStream fos = new FileOutputStream("consolidate.txt");
) {
byte[] buf = new byte[8192];
int i;
while ((i = fis.read(buf)) != -1) {
fos.write(buf, 0, i);
}
fis.close();
fis = new FileInputStream("report2.txt");
while ((i = fis.read(buf)) != -1) {
fos.write(buf, 0, i);
}
}
What is the result?
Given a language code of fr and a country code of FR, while file name represents a resource bundle file name that is not the default?
Given the error message when running you application:
Exception in thread "main" java.util.MissingResourceException: can't find bundle for base name messageBundle, Locale
And given that the Message Bundle.properties file has been created, exists on your disk, and is properly formatted.
What is the cause of the error message?
What statement is true about thread starvation?