Free Oracle 1Z0-808 Exam Braindumps (page: 3)

Given:
class Mid {
public int findMid(int n1, int n2) {
return (n1 + n2) / 2;
}

}
public class Calc extends Mid {
public static void main(String[] args) {
int n1 = 22, n2 = 2;
// insert code here
System.out.print(n3);
}
}
Which two code fragments, when inserted at // insert code here, enable the code to compile and print 12?

  1. Calc c = new Calc();
    int n3 = c.findMid(n1, n2);
  2. int n3 = super.findMid(n1, n3);
  3. Calc c = new Mid();
    int n3 = c.findMid(n1, n2);
  4. Mid m1 = new Calc();
    int n3 = m1.findMid(n1, n2);
  5. int n3 = Calc.findMid(n1, n2);

Answer(s): A,D

Explanation:

Incorrect:
Not B: circular definition of n3.
Not C: Compilation error. line Calc c = new Mid(); required: Calc
found: Mid
Not E: Compilation error. line int n3 = Calc.findMid(n1, n2); non-static method findMid(int, int) cannot be referenced from a static context



Given the code fragment:

  1. Option A
  2. Option B
  3. Option C
  4. Option D

Answer(s): A



Given the code fragment:




What is the result?

  1. 20
  2. 25
  3. 29
  4. Compilation fails
  5. AnArrayIndexOutOfBoundsException is thrown at runtime

Answer(s): A



Given the code fragment:

What is the result?

  1. May 04, 2014T00:00:00.000
  2. 2014-05-04T00:00: 00. 000
  3. 5/4/14T00:00:00.000
  4. An exception is thrown at runtime.

Answer(s): D

Explanation:

java.time.temporal.UnsupportedTemporalTypeException: Unsupported field: HourOfDay



Viewing page 3 of 60
Viewing questions 9 - 12 out of 245 questions



Post your Comments and Discuss Oracle 1Z0-808 exam prep with other Community members:

1Z0-808 Exam Discussions & Posts