1Z1-803 無料問題集「Oracle Java SE 7 Programmer I」
Given the code fragment:
// insert code here arr[0] = new int[3]; arr[0][0] = 1; arr[0][1] = 2; arr[0][2] = 3;
arr[1] = new int[4]; arr[1][0] = 10; arr[1][1] = 20; arr[1][2] = 30; arr[1][3] = 40;
Which two statements, when inserted independently at line // insert code here, enable the code to compile?
// insert code here arr[0] = new int[3]; arr[0][0] = 1; arr[0][1] = 2; arr[0][2] = 3;
arr[1] = new int[4]; arr[1][0] = 10; arr[1][1] = 20; arr[1][2] = 30; arr[1][3] = 40;
Which two statements, when inserted independently at line // insert code here, enable the code to compile?
正解:A、E
解答を投票する
Given:
public class Painting {
private String type;
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public static void main(String[] args) {
Painting obj1 = new Painting();
Painting obj2 = new Painting();
obj1.setType(null);
obj2.setType("Fresco");
System.out.print(obj1.getType() + " : " + obj2.getType());
}
}
What is the result?
public class Painting {
private String type;
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public static void main(String[] args) {
Painting obj1 = new Painting();
Painting obj2 = new Painting();
obj1.setType(null);
obj2.setType("Fresco");
System.out.print(obj1.getType() + " : " + obj2.getType());
}
}
What is the result?
正解:C
解答を投票する
Given the classes:
*AssertionError
*ArithmeticException
*ArrayIndexOutofBoundsException
*FileNotFoundException
*IllegalArgumentException
*IOError
*IOException
*NumberFormatException
*SQLException
Which option lists only those classes that belong to the unchecked exception category?
*AssertionError
*ArithmeticException
*ArrayIndexOutofBoundsException
*FileNotFoundException
*IllegalArgumentException
*IOError
*IOException
*NumberFormatException
*SQLException
Which option lists only those classes that belong to the unchecked exception category?
正解:C
解答を投票する
解説: (JPNTest メンバーにのみ表示されます)
Given:
public class ColorTest {
public static void main(String[] args) {
String[] colors = {"red", "blue","green","yellow","maroon","cyan"};
int count = 0;
for (String c : colors) {
if (count >= 4) {
break;
}
else {
continue;
}
if (c.length() >= 4) {
colors[count] = c.substring(0,3);
}
count++;
}
System.out.println(colors[count]);
}
}
What is the result?
public class ColorTest {
public static void main(String[] args) {
String[] colors = {"red", "blue","green","yellow","maroon","cyan"};
int count = 0;
for (String c : colors) {
if (count >= 4) {
break;
}
else {
continue;
}
if (c.length() >= 4) {
colors[count] = c.substring(0,3);
}
count++;
}
System.out.println(colors[count]);
}
}
What is the result?
正解:C
解答を投票する
解説: (JPNTest メンバーにのみ表示されます)