Which statement is true about the class of an object that can reference the variable base?

Given:
1. package geometry;
2. public class Hypotenuse {
3. public InnerTriangle it = new InnerTriangle();
4. class InnerTriangle {
5. public int base;
6. public int height;
7. }
8. }
Which statement is true about the class of an object that can reference the variable base?

Given:
1. package geometry;
2. public class Hypotenuse {
3. public InnerTriangle it = new InnerTriangle();
4. class InnerTriangle {
5. public int base;
6. public int height;
7. }
8. }
Which statement is true about the class of an object that can reference the variable base?

A.
The class must be a subclass of the class Hypotenuse.

B.
It can be any class.

C.
No class has access to base.

D.
The class must belong to the geometry package.

Explanation:



Leave a Reply 1

Your email address will not be published. Required fields are marked *


Sarita Jain

Sarita Jain

The class InnerTriangle has a “package level” scope since you have not specified any explicit access modifier. This means members in the class as well as members in the package are allowed access to the class.

answer 😀