nerdexam
Oracle

1Z0-851 · Question #100

Given: public class BuildStuff { public static void main(String[] args) { Boolean test = new Boolean(true); Integer x = 343; Integer y = new BuildStuff().go(test, x); System.out.println(y); } int…

The correct answer is B. 49. See the full explanation below for the reasoning.

Question

Given: public class BuildStuff { public static void main(String[] args) { Boolean test = new Boolean(true); Integer x = 343; Integer y = new BuildStuff().go(test, x); System.out.println(y); } int go(Boolean b, int i) { if(b) return (i/7); return (i/49); } } What is the result?

Options

  • A7
  • B49
  • C343
  • DCompilation fails.
  • EAn exception is thrown at runtime.

How the community answered

(30 responses)
  • A
    7% (2)
  • B
    70% (21)
  • C
    17% (5)
  • E
    7% (2)

Community Discussion

No community discussion yet for this question.

Full 1Z0-851 Practice