Examveda
Examveda

Which statements are most accurate regarding the following classes?
class A{
        private int i;
        protected int j;
}

class B extends A{
        private int k;
        protected int m;
}

A. An object of B contains data fields i, j, k, m.

B. An object of B contains data fields j, k, m.

C. An object of B contains data fields j, m.

D. An object of B contains data fields k, m.

Answer: Option B


This Question Belongs to Java Program >> Declaration And Access Control

Join The Discussion

Comments ( 1 )

  1. NETHRA K
    NETHRA K :
    8 years ago

    As 'j' is protected variable can be accessible to the subclass, whereas private variables are accessible to only within the class.

Related Questions on Declaration and Access Control