mercoledì 16 aprile 2014

Java 7 OCA 1z0-803: What is the result?

Given the following:
class Y {
 public static void main(String[] args) {
  int a[] = { 1, 2, 053, 4 };
  int b[][] = { { 1, 2, 4 }, { 2, 2, 1 }, { 0, 43, 2 } };
  
  System.out.print(a[3] == b[0][2]);
  System.out.print(" " + (a[2] == b[2][1]));
 }
}
What is the result?
A - true false
B - false false
C - false true
D - true true
E - Compilation fails.
Answer: D
More questions about Java 7 OCA 1z0-803?

Java 7 OCA 1z0-803: What is the result?

Given the following:
class Y {
 public static void main(String[] args) {
  int a[] = { 1, 2, 3, 4 }; // Line 3
  System.out.print(a instanceof Object); // Line 4
 }
}
What is the result?
A - Compilation fails due to error at line 3.
B - Compilation fails due to error at line 4.
C - Will produce output as false.
D - Will produce output as true.
E - Length of this array is 3.
Answer: D
More questions about Java 7 OCA 1z0-803?