Oracle Java SE 7 Programmer I - 1Z0-803 模擬練習
Given:
class Base {
public static void main(String[] args) {
System.out.println("Base " + args[2]);
}
}
public class Sub extends Base{
public static void main(String[] args) {
System.out.println("Overriden " + args[1]);
}
}
And the commands:
javac Sub.java
java Sub 10 20 30
What is the result?
class Base {
public static void main(String[] args) {
System.out.println("Base " + args[2]);
}
}
public class Sub extends Base{
public static void main(String[] args) {
System.out.println("Overriden " + args[1]);
}
}
And the commands:
javac Sub.java
java Sub 10 20 30
What is the result?
正解: B
Given:
public class DoBreak1 {
public static void main(String[] args) {
String[] table = {"aa", "bb", "cc", "dd"};
for (String ss: table) {
if ( "bb".equals(ss)) {
continue;
}
System.out.println(ss);
if ( "cc".equals(ss)) {
break;
}
}
} }
What is the result?
public class DoBreak1 {
public static void main(String[] args) {
String[] table = {"aa", "bb", "cc", "dd"};
for (String ss: table) {
if ( "bb".equals(ss)) {
continue;
}
System.out.println(ss);
if ( "cc".equals(ss)) {
break;
}
}
} }
What is the result?
正解: B
Given:


正解: D
Given:

What is the result?

What is the result?
正解: C
解説: (PassTest メンバーにのみ表示されます)
Identify two benefits of using ArrayList over array in software development.
正解: A,B
解説: (PassTest メンバーにのみ表示されます)
Given the fragment:
String[][] arra = new String[3][];
arra[0] = new String[]{"rose", "lily"};
arra[1] = new String[]{"apple", "berry","cherry","grapes"};
arra[0] = new String[]{"beans", "carrot","potato"};
// insert code fragment here
Which code fragment when inserted at line '// insert code fragment here', enables the code to successfully change arra elements to uppercase?
String[][] arra = new String[3][];
arra[0] = new String[]{"rose", "lily"};
arra[1] = new String[]{"apple", "berry","cherry","grapes"};
arra[0] = new String[]{"beans", "carrot","potato"};
// insert code fragment here
Which code fragment when inserted at line '// insert code fragment here', enables the code to successfully change arra elements to uppercase?
正解: C
解説: (PassTest メンバーにのみ表示されます)
Given:
package p1;
public interface DoInterface { void method1(int n1); // line n1
}
package p3;
import p1.DoInterface;
public class DoClass implements DoInterface { public DoClass(int p1) { } public void method1(int p1) { } // line n2 private void method2(int p1) { } // line n3
}
public class Test {
public static void main(String[] args) {
DoInterface doi= new DoClass(100); // line n4
doi.method1(100);
doi.method2(100);
}
}
Which change will enable the code to compile?
package p1;
public interface DoInterface { void method1(int n1); // line n1
}
package p3;
import p1.DoInterface;
public class DoClass implements DoInterface { public DoClass(int p1) { } public void method1(int p1) { } // line n2 private void method2(int p1) { } // line n3
}
public class Test {
public static void main(String[] args) {
DoInterface doi= new DoClass(100); // line n4
doi.method1(100);
doi.method2(100);
}
}
Which change will enable the code to compile?
正解: A
解説: (PassTest メンバーにのみ表示されます)
Given:
public class TestOperator {
public static void main(String[] args) {
int result = 30 -12 / (2*5)+1;
System.out.print("Result = " + result);
} }
What is the result?
public class TestOperator {
public static void main(String[] args) {
int result = 30 -12 / (2*5)+1;
System.out.print("Result = " + result);
} }
What is the result?
正解: C
Which two are valid declarations of a two-dimensional array?
正解: B,C
解説: (PassTest メンバーにのみ表示されます)
Given: Which two declarations will compile?


正解: A,C
View the exhibit.

Given the code fragment:

Which change enables the code to print the following?
James age: 20 Williams age: 32

Given the code fragment:

Which change enables the code to print the following?
James age: 20 Williams age: 32
正解: A