• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How Do I access ?

 
Greenhorn
Posts: 11
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Sheriff
Posts: 5555
326
IntelliJ IDE Python Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 5555
326
IntelliJ IDE Python Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ?
 
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Let's have a look at the Java® Tutorials: nested classes and access modifiers.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic