Oracle Certified Professional: Java SE 6 Programmer && Oracle Certified Expert: (JEE 6 Web Component Developer && JEE 6 EJB Developer)
|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|
Oracle Certified Professional: Java SE 6 Programmer && Oracle Certified Expert: (JEE 6 Web Component Developer && JEE 6 EJB Developer)
Dieter Quickfend wrote:it says x is defined in an inaccessible class or interface... But I have no problem in getting the class, just getting X. However, X doesn't have private access.
So that means, with a getter, I can get an A Object, but I don't have visibility on any of A's members? Then what use is the getter?
SCJP 93 % ,preparing for SCWCD
SCJP6.0,My blog Ranchers from Delhi
Sudhakar Sharma wrote:I got it, sorry for misinterpreting the question, but that's really a big question when class is accessible then why not its variable?
Please elaborate
Thank you.
Private modifier means private to a class,even if the class is marked a public and we marked its method as private,then method are bound to remain within a class.
SCJP6.0,My blog Ranchers from Delhi
Dieter Quickfend wrote:it says x is defined in an inaccessible class or interface... But I have no problem in getting the class, just getting X. However, X doesn't have private access.
Dieter Quickfend wrote:So that means, with a getter, I can get an A Object, but I don't have visibility on any of A's members? Then what use is the getter?
|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|
Sudhakar Sharma wrote:Hi All,
But the question is here, inner class is marked as private and we get that from the public accessor method. In the inner class we have variable x which have default access then when inner class's(which is marked as private) object can be accessible outside via the public method then we have object of that type why cannot we access their variable which have default accessibility?
Please elaborate
Thank you
SCJP6.0,My blog Ranchers from Delhi
SCJP6.0,My blog Ranchers from Delhi
SCJP6.0,My blog Ranchers from Delhi