Consider the following code:


public class B1

{


private int i;

private int j;



}


public class B2 extends B1

{

private int m;

private int n;



}


public class B3 extends B2

{

private int z;



}


Which of the following sets of instance variables are directly accessible in class B3?

i, j, m, n

i, j, m, n, z

i, j, z

m, n, z

z

Respuesta :

Answer:

The  answer is "z"

Explanation:

In this question, the "z" instance variable is correct because inside the class "B3" it declared a private variable "z", which is applied in the methods or data members or variables, and it is only accessible within the class, that they have been declared, and when we create its instance so, the object has been instantiated, and it is generated and accessible to all the builders, methods, or class blocks.

Neois

Answer:

4. m, n, z

Explanation:

This is because B3 extends off of B2. Meaning it has its own instance variables accessible, and can directly access the variable from it's super class, which is B2, which has m, and n.

RELAXING NOICE
Relax