1Z0-805日本語試験無料問題集「Oracle Upgrade to Java SE 7 Programmer (1Z0-805日本語版) 認定」

try {
String query = "SELECT * FROM Item";
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(query);
ResultSetMetaData rsmd = rs.getMetaData();
int rowCount = rsmd.getRowCount();
System.out.println ("Processing: " + rowCount + " rows.");
while (rs.next()) {
// Process each row
}
} catch (SQLException se) {
System.out.println("Error");
}

正解:C
解答を投票する
解説: (GoShiken メンバーにのみ表示されます)

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);
}
}

正解:C
解答を投票する
解説: (GoShiken メンバーにのみ表示されます)

class MyTask extends RecursiveTask<Integer> {
final int low;
final int high;
static final int THRESHOLD = /* . . . */
MyTask (int low, int high) { this.low = low; this.high = high; }
Integer computeDirectly()/* . . . */
protected void compute() {
if (high - low <= THRESHOLD)
return computeDirectly();
int mid = (low + high) / 2;
invokeAll(new MyTask(low, mid), new MyTask(mid, high));

正解:B,E
解答を投票する
解説: (GoShiken メンバーにのみ表示されます)

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"); }

正解:B
解答を投票する
解説: (GoShiken メンバーにのみ表示されます)

private static void copyContents (File source, File target) {
try {inputStream fis = new FileInputStream(source);
outputStream fos = new FileOutputStream (target);
byte [] buf = new byte [8192]; int i;
while ((i = fis.read(buf)) != -1) {
fos.write (buf, 0, i);
}
//insert code fragment here. Line **
System.out.println ("Successfully copied");
}

正解:A,B,C
解答を投票する
解説: (GoShiken メンバーにのみ表示されます)