File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Protected members in a protected static inner class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Protected members in a protected static inner class" Watch "Protected members in a protected static inner class" New topic
Author

Protected members in a protected static inner class

See Furst
Greenhorn

Joined: Aug 04, 2010
Posts: 29
Ok I came across an interesting dilema and was wondering if anyone could answer it.

This is probably not good practice and you would never do it.. but for an intellectual exercize

Lets say I have the following class in a package com.thing.mine:



Now how would a class outside the com.thing.mine package access the members of the static inner class?

Here are some attempts which came up with compiler errors



access error

and



access error

also this one for kicks




Also gave, to my surprise, an access error istead of a class not found error... According to convention com.thing.mine.StaticInner.SimpleConstants should be in com/thing/mine/StaticInner/SimpleConstats.java.. but I get an access error... That would certainly have my head banging against a wall for hours. Is that even to spec?

Anyway let me know what other stuff you all may find.

Thanks,
See.


Doin' Java to be one of the cool kids.
I usually use Perl;
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Protected members in a protected static inner class