Why are protected fields not-accessible from sub-classed inner class?

I ran across a situation at work where we have to sub-class an inner class from a third-party package. So, it looks something like this...
package SomePackage;
public class Outer {
   protected int x;
   public class Inner {
package OtherPackage;
public class NewOuter extends Outer {
   public class NewInner extends Outer.Inner {
}Now the NewInner class needs to access protected variables in the Outer class, just like the Inner class does. But because NewOut/NewInner are in a different package I get the following error message.
Variable x in class SomePackage.Outer not accessible from inner class NewOuter. NewInner.You can still access those protected variables from the NewOuter class though. So, I can write accessor methods in NewOuter for NewInner to use, but I am wondering why this is. I know that if NewOuter/NewInner are in the same package as Outer/Inner then everything works fine, but does not when they are in different packages.
I have to use JDK1.1.8 for the project so I don't know if there would be a difference in JDK1.2+, but I would think that nothing has changed. Anyway, if you know why Java disallows access as I have detailed please let me know.

Although I don't have the 1.1.8 JDK installed on my system, I was able to compile the following code with the 1.3.1_01 JDK and run it within a Java 1.1.4 environment (the JVM in the MSIE 5.5 browser). As long as you don't access any of the APIs that were introduced with 1.2+ or later, the classes generated by the JDK 1.2+ javac are compatible with the 1.1.4+ JVM.
//// D:\testing\SomePackage\Outer.java ////package SomePackage ;
public class Outer {
    protected int x ;
    public Outer(int xx) {
        x = xx ;
    public class Inner {
}//// D:\testing\OtherPackage\NewOuter.java ////package OtherPackage;
import SomePackage.* ;
public class NewOuter extends Outer {
    public NewOuter(int xx) {
        super(xx) ;
    public class NewInner extends Outer.Inner {
        public int getIt() {
            return x ;
}//// D:\testings\Test.java ////import OtherPackage.* ;
import java.awt.* ;
import java.applet.* ;
public class Test extends Applet {
    public void init () {
        initComponents ();
    private void initComponents() {
        add(new Label("x = ")) ;
        int myx = new NewOuter(3288).new NewInner().getIt() ;
        TextField xfld = new TextField() ;
        xfld.setEditable(false) ;
        xfld.setText(Integer.toString(myx)) ;
        add(xfld) ;
}//// d:\testing\build.cmd ////set classpath=.;D:\testing
cd \testing\SomePackage
javac Outer.java
cd ..\OtherPackage
javac NewOuter.java
cd ..
javac Test.java//// d:\testing\Test.html ////<HTML><HEAD></HEAD><BODY>
<APPLET CODE="Test.class" CODEBASE="." WIDTH=200 HEIGHT=100></APPLET>
</BODY></HTML>

Similar Messages

  • Why are my fields not moving with my Dynamic stamp ? Only the artwork appears

    Why are my fields not moving with my Dynamic stamp ? Only the artwork appears

    Sounds like you're a candidate for Lightroom...based on the time you don't
    want to spend in Photoshop.
    Photoshop install media is likely created in large batches, perhaps in a
    foreign country, so it's understandable that you get Photoshop 11.0.0 is on
    the media.
    I don't know as I would use ProPhotoRGB as my working space in Photoshop.  I
    was merely suggesting that you look at your color settings to make sure
    things were the same on both machines.
    How do you know your actions are the same?  Did you copy the action
    recording from one computer to the other, or did you merely record the same
    steps on each one?  Have you compared the details of each action step in the
    Actions Palette to make sure they are the same?  The symptoms still sound
    like something different than sRGB being the output color-space, or the fact
    it isn't embedded on one or the other of the computers.
    How are you viewing the JPG when it looks the same or different than the
    RAW?  Are you looking at the side-by-side in Photoshop, or side-by-side in
    Bridge, or are you using a mixture of viewers, one Adobe, and one not?  And
    are you using the Canon Codec on Vista or not?  The Canon Codec would be
    showing the camera-preview in the RAW not the RAW adjustments that Adobe has
    done.
    While the OS shouldn't be causing a difference in how the action is run, a
    difference between OSes may make a difference in the processing to show up.
    The camera profile associated with a RAW file is visible in the
    third-from-right tab in ACR over at the right.  The one with the little
    DSLR-camera icon on the tab.
    Can you attach the two JPGs on a reply, here, or if not, upload a ZIP of the
    two JPGs and the RAW to a file-sharing site like http://www.rapidshare.com/
    and post the download link(s)?

  • Why are my emails not deleting from all devices when deleted from one?  I have iCloud set up and turned on. I have ipad2, iphone5 and a Mac. What am I doing wrong?  Thank you

    Why are my emails not deleting from all devices when deleted from one?  I have iCloud mail set up and turned on. I have ipad2, iPhone 5 and a Mac desktop. What am I doing wrong?  Thank you.

    It depends on the type of email account you are using, not on iCloud.  If you are using an IMAP or exchange account, when you delete from one device, it is deleted from all devices.  If you are using a POP (POP3) account, it won't.  (iCloud email, Gmail and Yahoo are all IMAP accounts.)

  • Music I purchased on I Tunes is not available when I open ITunes in I Movie.  I Movie says those files are "protected" and not accessible.  What does that mean and can I change them to "unprotected" so I can use them in IMovie?

    Most of the music that I purchased on I Tunes I bought and downloaded on my old I Mac which I replaced with this I Mac about 9 months ago.  When I"m using I Movie on this I Mac and try to open I Tunes tab in I Movie, most of the files are not accessible because I Movie says those fields are protected. What does that mean and can I change those files to unprotected so they show up in my music in IMovie?
    This I Mac is OS X version 10.9.5 Maverick, 2.7GHz Intel Core 15 processor, 8GB 1600MHz DDR3 memory.

    Your older iTunes music purchases included DRM software to prevent sharing.
    iTunes Store: iTunes Plus Frequently Asked Questions (FAQ) - Apple Support
    For some money you can get it removed and get a better quality file to boot.

  • Why are Network Settings not Transferring from a Master DMG to the Desitination

    Hi people,
    can anyone assist me with finding out why Network Settings are NOT transferred from a source Master HD to a DMG to a Destination HD.
    I have many hours spent trying to debug this - any pointers to a solution would be greatly appreciated.
    Background:
    I administer about 400 Macs of mixed types / generations (iMacs - MacBooks - MacBook Pro's).
    We create master setups for different locations / purposes around the Campus and transfer these masters to DMGs.
    We then clone the various macs as needed from these DMGs using a variety of methods including local (FW800 - USB) and network transfers.
    The newest master (staffHD at 10-8-2) works perfectly but trying to clone / copy it by any method leaves out the custom network settings and you only end up with the default Wi-Fi / Ethernet / Firewire with total loss of the additional services and custom proxy settings.
    Methods used to date to try the transfer (all get the same null result)
    to-from DMG using Disk Utility
    to-from Sparse Image via Disk Utility
    to-from DMG using Carbon Copy Cloner
    to-from Sparse Image via Carbon Copy Cloner
    direct to 'target disk' via FW800 using Disk Utility
    direct to 'target disk via FW800 using Carbon Copy Cloner
    direct to 'target disk via FW800 using rsync -aHv
    direct to 'target disk via FW800 using cp -Rv
    Everything BUT the network settings transfer perfectly (excluding of course the usual trackpad / mouse custom settings).
    I guess something is wrong with this master source but for the life of me I can't work it out. I have seen it in the past but it seemed to work itself out with the next revision - this one just wont.
    HELP!
    Have a Great day!
       pete

    Hi Linc,
    thanks for the reply - I suspected a hardware issue or some sort of privledges problem, but as far as I know have only had this problem with Mountain Lion, and it still fails on hardware like to like transfers. I was hoping to avoid needing anything addidtional but it looks like I'll have to.
    Have a Great day!
       pete

  • Why are my playlists not syncing from iTunes to my iPhone since updating to iTunes 11.0.2?

    My selected playlists are not syncing from Itunes to my iPhone.  As a music teacher this is extremely problematic as I use my phone as my primary music player.  Anyone know why all music syncs but not the playlists?

    First, you're not talking to Apple - this is a users' forum.  Second, sync operations work one way - iTunes to iDevice; create and modify your playlists in iTunes, then sync them to your iPhone.

  • Why are my photos not syncing from my iPhone6 to my laptop?

    What is going on with synchronizing photos from iPhone 6 to windows laptop?
    I spend so much time searching for photos, it's ridiculous.
    What the heck is iCloud for? I don't get it - nothing works.
    I am forced to use Flickr to synchronize my photos, because I don't have any idea what Apple is doing with them.
    Ugh! I'm sick of wasting time "fixing" my device - who will figure out a way to make these things WORK???

    Thank you - I have read that support column many times.
    However, when I open the folder indicated by the article, the photos are NOT there.
    The last time my Photo Stream folder updated was April 2014. For awhile, my photos were uploading to a folder called iCloud Photos, with a sub-folder called Photo Stream.  The last time that one updated was September 2014.  I have the latest version of iTunes and iOS.
    So, again, I ask - why aren't my photos synchronizing with my laptop via Photo Stream?  I have to connect the phone with a WIRE to my laptop and then I can backup my photos. (Which I do frequently, anyway, in order to save the photos permanently.)
    Why don't you guys invent something like Flickr - that AUTOMATICALLY synchronizes photos from my extremely expensive iPhone 6 to my other devices? That would be so handy.
    Sorry for being annoyed, but it's annoying.  Every time I try to do something with a photo, I have to figure out how to get it off my phone. I email, message, download, save to Dropbox, save to Flickr.  It's ridiculous.  If Photo Stream worked, I could just use that - it would be so SIMPLE I might actually be able to get to the project, instead of wasting time messing with the stupid photos.
    If there's something I'm doing wrong, I wish someone would help me.

  • Why are the images not printing from InCopy? Why is the relink button in Links panel ghosted?

    I am having a problem with printing from Incopy. All stories are editable and that is working just fine. I am able to view the images although AD has set the graphics to not be editable yet I can still see them of course.
    My problem is upon wanting to print the layout. Getting a message that the image links are missing. I have not moved the original folders (they are all set up on the same level in one main folder). I am working remotely, layout based workflow via dropbox.
    My client would like to have the option to print layouts also initially. How can I relink the images if the "relink" button is ghosted. Can somebody help me please? I have tried doing a restart… Any ideas? 

    the-edmeister, you are a genious. I went to "view" then "toolbars" and de-selected "yahoo toolbar" and then moved the curser over my firefox page and it now works completely including the problem area (the top 3 cm of each screen). Thank you, thank you, thank you, thank you, thank you, thank you. You have no idea how good I feel know on this otherwise cold, windy and rainy day.

  • Why are some objects not printing from Illustrator after I print to PDF?

    Hi,
    I've printed a large Illustrator CS6 document to PDF (using Adobe PDF setting in print dialog box), and it looks just fine when I view the PDF. The problem is that some lines do not print when I try to print the PDF on paper. I've tried adjusting settings and printing to the PDF in different ways, but can't figure it out. Everything looks great on the screen, but some lines are missing once printed to paper. Others have tried printing the PDF as well and are also getting missing lines.
    Any suggestions?! Thanks!

    I've tried selecting print all layers, and I'm also tiling the pages to a custom page size. I've left all the other settings at default. Everything looks perfect on screen, but parts of the same object do not print. I tried to attach a screen shot but am getting an error. Basically each page has a border around it, and one side of the border is not printing on certain pages.

  • Why are my contacts not syncing from my iphone to my mac?

    I enter phone numbers on my iphone, but they don't seem to be showing up on my computer, even after I have synced.  I have no idea why.  I'm thinking of shutting off iCloud (I don't see any benefit to it right now, unless I'm using it wrong), will that help?  I'm getting very frustrated having to enter contacts twice (one in my phone when I'm out and about, and another time if I want it on my computer's address book).

    Have you done any of Apple's recommended troubleshooting?
    See: iCloud: Troubleshooting iCloud Contacts
    It's also helpful to mention what OS you are using on your iPhone and Mac.

  • My bookmarks used to appear in dropdown menu from the address bar on my iMac G5. I switched to Mac Notebook & from Leopard to Lion. Now my bookmarks are not accessible from the address bar anymore (the line where you type in the website address)

    '''My bookmarks used to appear in dropdown menu from the address bar on my iMac G5. I switched to Mac Notebook & from Leopard to Lion. Now my bookmarks are not accessible from the address bar anymore (the line where you type in the website address)'''

    There appears to be a problem with Firefox 20 with UNC paths when using roaming profiles on a server.
    *[[/questions/955140]] why is the 20.0 address bar unresponsive?
    This is currently investigated and tracked via this bug report.
    *[https://bugzilla.mozilla.org/show_bug.cgi?id=857672 bug 857672] - Address Bar not working (roaming profiles;UNC path support OS.File)
    <i>(please do not comment in bug reports: [https://bugzilla.mozilla.org/page.cgi?id=etiquette.html])</i>

  • Why are certain albums like ones from Tool or Ozzy era black sabbath not available in the U.S. store

    why are certain albums like ones from Tool or Ozzy era black sabbath not available in the U.S. store

    Also, in some cases the artist will not allow download sales, or insists on a download store selling complete albums only rather than offering individual tracks, something Apple resists. In any case, it's not by Apple's choice; it's by decision of the content owners.

  • Method not accessible from other classes

    Hi,
    I ve defined a class and would like to create an instance of it from another class. That works fine, I am also able to access class variables. However the class method "calcul" which is defined as following, is not accessible from other classes:
    class Server {
    static String name;
    public static void calcul (String inputS) {
    int length = inputS.length();
    for (int i = 0 ; i < length; i++) {
    System.out.println(newServer.name.charAt(i)); }
    If I create an instant of the class in the same class, the method is then available for the object.
    I am using JBuilder, so I can see, which methods and variables are available for an object. Thanks for your help

    calcul is a static method, that means you do not need an instance of server to run this method. This method is also public, but your class Server is not, your Server class is package protected. So only classes within the same package has Server can use its method. How to use the calcul method?// somewhere in the same package as the Server class
    Server.calcul( "toto" );

  • Why are the iPhotos not listed in the finder?

    why are the iPhotos not listed in the finder?

    There are many, many ways to access your files in iPhoto:   You can use any Open / Attach / Browse dialogue. On the left there's a Media heading, your pics can be accessed there. Command-Click for selecting multiple pics.
    (Note the above illustration is not a Finder Window. It's the dialogue you get when you go File -> Open)
    You can access the Library from the New Message Window in Mail:
    There's a similar option in Outlook and many, many other apps.  If you use Apple's Mail, Entourage, AOL or Eudora you can email from within iPhoto.
    If you use a Cocoa-based Browser such as Safari, you can drag the pics from the iPhoto Window to the Attach window in the browser.
    If you want to access the files with iPhoto not running:
    For users of 10.6 and later:  You can download a free Services component from MacOSXAutomation  which will give you access to the iPhoto Library from your Services Menu.
    Using the Services Preference Pane you can even create a keyboard shortcut for it.
    For Users of 10.4 and 10.5 Create a Media Browser using Automator (takes about 10 seconds) or use this free utility Karelia iMedia Browser
    Other options include:
    Drag and Drop: Drag a photo from the iPhoto Window to the desktop, there iPhoto will make a full-sized copy of the pic.
    File -> Export: Select the files in the iPhoto Window and go File -> Export. The dialogue will give you various options, including altering the format, naming the files and changing the size. Again, producing a copy.
    Show File:  a. On iPhoto 09 and earlier:  Right- (or Control-) Click on a pic and in the resulting dialogue choose 'Show File'. A Finder window will pop open with the file already selected.    3.b.
    b: On iPhoto 11 and later: Select one of the affected photos in the iPhoto Window and go File -> Reveal in Finder -> Original. A Finder window will pop open with the file already selected.

  • Why are my contacts not showing up in my iMessage on my macbook pro?

    Why are my contacts not showing up in my imessage on my macbook pro?

    open messages. go to messages>preferences>accounts. select your icloud account from the left sidebar, and uncheck 'enable this account' then recheck 'enable this account'
    you should also be using icloud to sync your contacts. sytem preferences>icloud. check the 'contacts' box

Maybe you are looking for

  • Seeing unknown servers on my network (Follow-up Question)

    This is basically a further question as to the issues raised in this thread: http://discussions.apple.com/thread.jspa?messageID=6803445&#6827736 Okay..... so i've gone searching trying to find something in regards to this problem and thus far have go

  • Home Button Acts up Need some help please

    Hello, My iPhone 3GS keeps hitting the home button by itslef and wont let me do anything and I have tried resetting my phone and everything but doesnt work what do I do. My iPhone is currently at iOS 5.1.1.

  • Missing item in package

    I ordered the "Belkin - Home and Vehicle Chargers for Select Apple® iPad®, iPhone®, and iPod® Models" on 5/16. I received the package today (5/20), but only found the home charger in there, and the vehicle charger was missing. I noticed that on the s

  • How do you record the iPod touch 5th generation screen for free

    I treys that weebly website but that doesn't work it says the website doesn't exist 

  • Details tab in monitor screen

    Can anyone please tell me in RSMO screen Details tab  we have 1. Request 2. Extaction 3. Transfer 4.Processing 5. subsequent processing 6. Datastore Activation 7.Subsequent update 8. process chain 9.others What is the message each one of these giving