nerdexam
Oracle

1Z0-851 · Question #39

Given: package geometry; public class Hypotenuse { public InnerTriangle it = new InnerTriangle(); class InnerTriangle { public int base; public int height; } } Which statement is true about the…

The correct answer is C. The class must belong to the geometry package. See the full explanation below for the reasoning.

Question

Given: package geometry; public class Hypotenuse { public InnerTriangle it = new InnerTriangle(); class InnerTriangle { public int base; public int height; } } Which statement is true about the class of an object that can reference the variable base?

Options

  • AIt can be any class.
  • BNo class has access to base.
  • CThe class must belong to the geometry package.
  • DThe class must be a subclass of the class Hypotenuse.

How the community answered

(31 responses)
  • A
    3% (1)
  • B
    10% (3)
  • C
    84% (26)
  • D
    3% (1)

Community Discussion

No community discussion yet for this question.

Full 1Z0-851 Practice