Given the following my.school.ClassRoom and my.city.School class definitions, which
line numbers in main() generate a compiler error? (Choose all that apply)
A. None, the code compiles fine.
B. Line 5
C. Line 6
D. Line 7
E. Line 8
F. Line 9
The correct answer is B,D,F,C
I inderstand that:
B causes compile error because globalKey access set to default meaning that only the classes in the same package can view it
D causes compile error because roomNumberis is private
F causes compile error because teacherName is protected and School does not extend ClassRoom
I cannot understand why C causes compile error.
Classroom room = new Classroom(101, ""Mrs. Anderson");
It just creates a new instance of the class.
Please look at the access modifier for the Classroom constructor.