1Z1-805 無料問題集「Oracle Upgrade to Java SE 7 Programmer」
Given the code fragment:
Path path1 = Paths.get("D:\\sales\\.\\quarterly\\..\\report");
path1 = path1.normalize();
Path path2 = path1.relativize(Paths.get("d:\\empdetails.dat"));
path2 = path2.resolve(path1);
System.out.println(path1);
System.out.println(path2);
}
What is the result?
Path path1 = Paths.get("D:\\sales\\.\\quarterly\\..\\report");
path1 = path1.normalize();
Path path2 = path1.relativize(Paths.get("d:\\empdetails.dat"));
path2 = path2.resolve(path1);
System.out.println(path1);
System.out.println(path2);
}
What is the result?
正解:D
解答を投票する
解説: (JPNTest メンバーにのみ表示されます)
Given the code fragment:
public class TestString {
public static void main(String[] args) {
String str=null;
switch(str) {
case "":
System.out.println("blank"); break;
case "null":
System.out.println("NULL"); break;
default:
System.out.println("invalid"); break;
}
}
}
What is the result?
public class TestString {
public static void main(String[] args) {
String str=null;
switch(str) {
case "":
System.out.println("blank"); break;
case "null":
System.out.println("NULL"); break;
default:
System.out.println("invalid"); break;
}
}
}
What is the result?
正解:A
解答を投票する
解説: (JPNTest メンバーにのみ表示されます)
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?
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?
正解:B
解答を投票する
解説: (JPNTest メンバーにのみ表示されます)