A student submitted the following:
Please see the attached file. Answer option D is, in fact, correct. Classes outside of the package cannot see the class, so there can be NO subclasses that exist outside of the package. The question does not specify that the subclasses must be able to exist outside the package. Based on both of these facts, all subclasses of a class with default access can access the classes method.
About Question enthuware.ocajp.i.v8.2.1330
Moderator: admin
-
- Posts: 5
- Joined: Mon Oct 03, 2016 3:41 am
- Contact:
About Question enthuware.ocajp.i.v8.2.1330
- Attachments
-
- enthuware.ocajp.i.v8.2.1330_screencast.png (154.41 KiB) Viewed 1878 times
-
- Site Admin
- Posts: 10388
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v8.2.1330
The given answer is correct. The access control that is being talked about in the question is for the method. Not for the class. The question does not specify access control on the class. So you need to consider all possibilities. What if the class is public and you don't specify any access control keyword on the method?
-Paul.
-Paul.
Who is online
Users browsing this forum: Google [Bot] and 9 guests