• Post Reply Bookmark Topic Watch Topic
  • New Topic

How Do I access ?  RSS feed

 
Navanethan Muthusamy
Greenhorn
Posts: 11
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Tim Cooke
Marshal
Posts: 4051
239
Clojure IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do you think you would access it? What have you tried?

Also, this is a very odd example. Can you please tell us where you got it from? You must QuoteYourSources
 
Navanethan Muthusamy
Greenhorn
Posts: 11
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I am exploring on protected access. Can we have protected method in protected inner class ? And how do we access it ?
 
Tim Cooke
Marshal
Posts: 4051
239
Clojure IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm still interested to hear about what you have tried out for yourself?

The example is very odd, in that there's a number of factors at play. You are dealing with protected access modifier on the class level, as well as on the method level. You're also dealing with an inner class, class inheritance, and to top it off you're mixing static and instance contexts.

I suggest you break your example down to tackle one thing at a time. Start simple, then build on that.
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim Cooke wrote:
I suggest you break your example down to tackle one thing at a time. Start simple, then build on that.


I also recommend that the OP explain, in detail, what was found out -- and how is the OP going to "build on that". This way, we can make sure you are heading in the correct direction.

All in all, it should be straightforward. A complexity, that may occur, is if you attempt to subclass the inner class from another inner class. It does work, but Java has a different way to allow constructors to access the outer class and the super class (which in this case, is not the same) ... and you may not have learned it yet.

Henry
 
Navanethan Muthusamy
Greenhorn
Posts: 11
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Henry Wong wrote:
if you attempt to subclass the inner class from another inner class. It does work, but Java has a different way to allow constructors to access the outer class and the super class (which in this case, is not the same) ... and you may not have learned it yet.


Please guide...How do I achieve ?
 
Campbell Ritchie
Marshal
Posts: 56599
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let's have a look at the Java® Tutorials: nested classes and access modifiers.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!