Are private members inherit or not??

Hi, I read the Sun Java tutorial twice times in this year about this topic.
March 2006, it says:
"A subclass inherits all the members variables and methods from its superclass. However the
subclass might not have access to an inherited member variable or method. For example a
subclass cannot access a private member inherited from its superclass. One might think ,then ,
that the item was not inherited at all. But the item is inherited."
September 2006, it says:
"A subclass does not inherit the private members of its parent class. However, if the superclass
has public or protected methods for accessing its private fields, these can also be used by the subclass.
A nested class has access to all the private members of its enclosing class�both fields
and methods. Therefore, a public or protected nested class inherited by a subclass has indirect access
to all of the private members of the superclass".
Which is wrong? Are private members inherit or not??

I teach Java 101 now and then. When I describes classes, sub-classes and access modifyers I use this metaphor:
Look at a class as a cardboard box. On the left outside of the box, you can write the names of the methods and attributes that you want others to see. These are the ones marked with public.
On the bottom outside of the box, you write all the names of attributes and methods that can be seen by classes that extends your class, sub-classes. These are the ones marked with protected.
Somehow, you are able to read the text on the outside when standing inside the box... has something to do with the pen that you use... ;-)
On the inside of the box you can write whatever you want that you do not want anyone else to see. These are marked private.
When creating a sub-class the sub-class-boxes are designed in such a way that it has a glass shelf halfway up on the right wall where you place your super-class-cardboard-box and a small window that allows users on the outside to look at the left side of the super-class-box. That is the only difference between a sub-class and a super-class-box.
Standing outside of the sub-class-box, you can read the left side of the sub-box and the left side of super-box through the window.
Standing inside the box, you can also read the bottom of the super-box through the glass-shelf.

Similar Messages

  • Are private methods inherently final?

    You can�t override a private method, so is it inherently final? Will the compiler treat it like a final? I�ve heard that final methods may be inlined by the compiler but haven�t really been able to produce a test to show the advantage of inlining. I know in theory it trades speed for program size, but, if it does work, is it really that much faster? I�m guessing CPU local cache probably eliminates or at least reduces to negligible time the overhead of swapping out the instruction stack to perform a �jump.�
    Thanks for your thoughts. Mostly trying to figure out when to use final methods.

    You can�t override a private method, so is it
    inherently final? Given that that is exactly what the JLS says it would
    suggest that the answer is yes.
    http://java.sun.com/docs/books/jls/second_edition/html
    /classes.doc.html#38958
    I believe the invocation (byte code) is different as
    well (but I didn't look it up) so the VM could
    certainly easily do something with it.Actually, I don't think this is 100% accurate.
    You can replace a private method in a subclass with the same signature (name, arg list) with the same return type. In fact, this is true even if the private method is declared final. It is only when the final method is public (maybe protected and package, I'm not sure) that the compiler complains when you try to extend it.
    � {�                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • I have an iphone4 and that I have had for four years and they are saying that I am not eligible for an upgrade until the end of July 2015. That is four years and 3 months after I purchased this phone. "Customer service" said I had an upgrade at the end of

    I have an iphone4 and that I have had for four years and they are saying that I am not eligible for an upgrade until the end of July 2015. That is four years and 3 months after I purchased this phone. "Customer service" said I had an upgrade at the end of July 2013, which I did not. She said that in the system my husband took an upgrade July 29th 2013. He didn't even have a Verizon phone, he had a work phone with T-mobile. I have asked what device he supposedly upgraded to since no phones have been activated and we all still have our same phones and numbers. Remember at the time, said husband had a work phone with T-mobile. I still have the very same phone as do all of the rest of my family members. No one has upgraded. I spoke with "customer service" for more than a half an hour today, Char promised me that her supervisor (Emily) would call me back by 7:30 tonight to clear up this problem. Well guess what? No call back so where should I go from here? Any advice or help would be greatly appreciated. Thank you for your help.

    someone swapped upgrades.  Phone could have been sold For quick cash. 

  • Public settings with selected private members

    Is it possible to run Javadoc with the default settings ie. no -private option but in some way select specific private members in a class to be documented. I have a set of classes that I only wish to generate docs for the public attributes & methods, all private methods AND private attributes that have been tagged at the top of the class as /** PRIVATE ATTRIBUTE DESCRIPTION */. I guess not but worth a shot.
    Thanks in advance,
    Iain

    While this is possible, we have decided not to include such
    a facility in javadoc. A third party has implemented
    the ability to exclude members, but apparently not
    the ability to force their inclusion.
    http://java.sun.com/j2se/javadoc/faq/index.html#ydoc
    The serialized form page is the only page that documents
    private members while using the default access (-protected),
    so javadoc has the capacity to do what you're asking.
    You would need to modify the standard doclet. With the new
    doclet toolkit in Tiger (1.5.0), this might be somewhat
    easier.
    -Doug Kramer
    Javadoc team

  • HT3819 how do I share movies/music between my computers. I have opened shared on both computers and both are on, but i am not able to drag anything from one to the other. Does anyone know where the settings button is on the bottom of the itunes screen?

    how do I share movies/music between my computers. I have opened shared on both computers and both are on, but i am not able to drag anything from one to the other. Does anyone know where the settings button is on the bottom of the itunes screen?

    Oops, I forgot a step between 7 and 8 ... before syncing the iPhone I need to explicitly send the document back to iTunes on the iPhone, or the changes won't come over at all ...
    and then one more thing ... Numbers on iOS does NOT recognize a number of key features of the OSX app, such as conditional formatting ... so after editing my document on iOS and syncing it back to OSX on my Mac, all of those settings are lost (no more conditional formatting, have to do it all over again)
    What am I doing wrong ?

  • When I create a playlist and sync it to my iPhone not all of the playlist transfers over.  All of the songs are there and are playable they just do not show up on the playlist.

    When I create a playlist and sync it to my iPhone not all of the songs on the playlist transfer over.  All of the songs are there and are playable they just do not show up on the playlist.  For example, in itunes on my computer a playlist has over 100 songs, but when I sync my phone, my iphone only shows 60 songs.  I can go into my phone and add the missing songs to the playlist, but the next time I sync my phone the songs are gone again.

    Wondering if you haven't been bitten by the new "feature" of iOS 5, as was my son. turingtest2 explained it very well in reply to my own query about "missing" songs in playlists.
    Here's that thread...
    https://discussions.apple.com/message/16903613#16903613

  • Email Alerts are working for some but not all users

    If some users are getting the alerts and some not, it seems more likely that the issue is with your email server or email clients, not with your SW setup.
    Have you checked SPAM / Junk folders on the server and on the clients?

    We have alerts setup for multiple scenarios.  All of our users are setup the same but not everyone is getting the alert.  We are using the spiceworks mail servers and I have checked the Spiceworks App Notifications are set to Yes.  Any ideas?  
    This topic first appeared in the Spiceworks Community

  • After the recent update the entire browser, including menus, icons, and everything on the web page, are too small. Fonts are smaller, pics are smaller, zoom settings will not remain universal. Minimum font size will make text readable, but all pics are to

    The new update has screwed up my browser settings, I cannot get them fixed and Im pissed because my computer is an eye-sore to read until this is fixed! EVERYTHING in the browser is smaller, fonts, menus, icons, web page content, pictures, tables, etc. I have set the minimum font in the settings and the text is just to a point where it is easily readable at the maximum size setting, but all the menus and icons are still tiny and hard to read. The last version I had installed worked fine with no add-ons needed. Everything fit the screen fine and was easily readable without modification. I want this version off my PC and I want the last version I had back on but I dont know what version it was!!!!!!! ARARGGGG
    In fact, this stupid troubleshooting window that I am in filling out this form doesnt fit the page right at all, and edges of the text are cut off, so Im not even sure what some of these boxes are asking for!!

    See [[Toolbars and page content appear too large after upgrading to Firefox 3]]
    *Try to adjust the DPI setting, see http://kb.mozillazine.org/layout.css.dpi
    *Try to set the pref layout.css.devPixelsPerPx to 2 on the about:config page.
    To open the ''about:config'' page, type '''about:config''' in the location (address) bar and press the Enter key, just like you type the url of a website to open a website.
    If you see a warning then you can confirm that you want to access that page.
    If you need to increase (or decrease) the font size on websites then look at:
    Default FullZoom Level - https://addons.mozilla.org/firefox/addon/6965
    NoSquint - https://addons.mozilla.org/firefox/addon/2592

  • When i try to open Photoshop 7.0 I get a message "the search discs are full" and it will not open. Help?

    When I open Photoshop 7.0 I get the message "the search discs are full"  and it will not open.  Help?

    Is your scratch drive over 1 Terabyte? Photoshop 7 was never programmed for those sizes  and will return that type of error if you recently changed drives,
    Solution is to partition that drive to less than one 1 TB or find a smaller drive.
    And update to 7.0.1 Adobe - Photoshop : For Windows : Adobe Photoshop 7.0.1 update
    Gene

  • When I am NOT private browsing Firefox will not allow me to delete or change the website address in the location bar. My only remedy is to open a new window and search in google then click the link to that site through google. How can I resolve this?

    Question
    When I am NOT private browsing Firefox will not allow me to delete or change the website address in the location bar. My only remedy is to open a new window and search in google then click the link to that site through google. When I swap to private browsing firefox allows me to anter the website address directly into the location bar - but this is a slow [prcess to swap back and forth - also by dint of using private browsing I loose my website information.

    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.com/kb/Safe+Mode
    *https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes

  • HT201269 Hi. I have shared an Apple ID with my children for some time.  As they are getting older they do not wnat me seeing all their messages, photos etc so want their own accounts.  How can they access their purchased music and apps on the new account

    Hi. I have shared an Apple ID with my children for some time.  As they are getting older they do not wnat me seeing all their messages, photos etc so want their own accounts.  How can they access their purchased music and apps on the new account please?

    Yes.
    On their iOS devices, under Settings>iTunes & App Store, they should use your Apple ID. When they log into iCloud, iMessage and Facetime, they should use their personal Apple IDs.

  • How come although iPads are getting more powerful, the iOS apps from apple are so mediocre and just not that great? We spend all this money for the latest ipad and all we get is these $5 video and music apps from apple. Why create the iOS platform and onl

    How come although iPads are getting more powerful, the iOS apps from apple are so mediocre and just not that great? We spend all this money for the latest ipad and all we get is these $5 video and music apps from apple. Why create the iOS platform and only offer so so apps like IMovie and GarageBand ? While other developers are offering much better apps like pinnacle studio for video, Cubasis and Auria for music production, apple has not showed much growth in terms of innovation. While there's nothing wrong with making an app like GarageBand where "anyone " can make a song, how about something for real musicians or an app not so basic as it get for video editing? After spending 0ver $700 on an ipad I'd be willing to spend more than $5 for a better video or audio app.

    First, try a system reset although I can't give you any confidence.  It cures many ills and it's quick, easy and harmless...
    Hold down the on/off switch and the Home button simultaneously until you see the Apple logo.  Ignore the "Slide to power off" text if it appears.  You will not lose any apps, data, music, movies, settings, etc.
    If the Reset doesn't work, try a Restore.  Note that it's nowhere near as quick as a Reset.  It could take well over an hour!  Connect via cable to the computer that you use for sync.  From iTunes, select the iPad/iPod and then select the Summary tab.  Follow directions for Restore and be sure to say "yes" to the backup.  You will be warned that all data (apps, music, movies, etc.) will be erased but, as the Restore finishes, you will be asked if you wish the contents of the backup to be copied to the iPad/iPod.  Again, say "yes."
    At the end of the basic Restore, you will be asked if you wish to sync the iPad/iPod.  As before, say "yes."  Note that that sync selection will disappear and the Restore will end if you do not respond within a reasonable time.  If that happens, only the apps that are part of the IOS will appear on your device.  Corrective action is simple -  choose manual "Sync" from the bottom right of iTunes.
    If you're unable to do the Restore, go into Recovery Mode per the instructions here.

  • I have synced my ipod many times, but for some reason it will no longer sync the apps, and says there are app installed that can not be determined. What should I do?

    I have synced my ipod many times, but for some reason it will no longer sync the apps, and says there are apps installed that can not be determined. What should I do?

    See these previous discussions:
    not determined
    iTunes cannot sync... apps not determined installed on...: Apple Support Communities
    installed apps could not be determined...: Apple Support Communities

  • Can anyone help me figure out how to sync my ipod with my purchased music?  I have used several computer and at one point synced my ipod with a computer that only had about half of my music.  My other computers are no longer working.  Not sure how to get

    Can anyone help me figure out how to sync my ipod with my purchased music?  I have used several computer and at one point synced my ipod with a computer that only had about half of my music.  My other computers are no longer working.  Not sure how to get my purchased music back onto my ipod?

    Hi kimcinma!
    Your previous purchases are saved on iCloud even if you bought them on another computer. If you can't find them on your current computer, you might need to unhide them. Go to iTunes preferences, and click on Store Preferences. Then click the box for "show iTunes in the Cloud purchases". Then click on OK, and everything you've ever bought from iTunes on that Apple ID will show up in your library. You will need to download them from iCloud first before you can synch them to your iPod Classic. To do this, click on the little cloud with the arrow in it next to your song, and it will download to your computer. When you have the music that you want downloaded, plug in your iPod and synch away. Hope this helps!
    Sandygirl

  • I recently upgraded to iOS 8. Looks like the pics I had in my messages are no longer appearing as pictures, rather they are appearing as JPEG files (not broken jpegs). I need to get these pics. Can't figure out how to do it. I'm on an iPhone 5C.

    I recently upgraded to iOS 8. Looks like the pics I had in my messages are no longer appearing as pictures, rather they are appearing as JPEG files (not broken jpegs). I need to get these pics. Can't figure out how to do it. I'm on an iPhone 5C.
    I've tried resetting my phone, looking for the pics in the new 'deleted' folder. I tried forwarding the jpegs to sees if they'll appear in a new message (but turnout the phone won't let me forward these pics). Apple is trying to say it's the 30 day reason, but I know that is not the problem. ALl of my pics older than 30 days were viewable. It is the upgrade that screwed this up. Help! Important pics!

    Try this to learn about using keys:
    http://www.apple.com/support/macbasics/
    You can also use your PC mouse.
    As for iPhoto, it sounds like you were trying to move files around in the library. That is a bib no-no in Aperture or iPhoto.

Maybe you are looking for

  • When editing an image in ps from a lr 4.2 smart collections image not shown back in smart collection

    Hi all, I have noticed at LR 4.2, that if you edit an image of a smart collection using PS (edit in PS function threw LR) and then save, the image is not appearing in the specific smart collection. Instead  image appears in the parent folder from whe

  • Help with imagemap effect in java not applet

    Hi, I would like my java application to show a frame with an image, that is clickable depending on pic's xy coordinates (the xy coordinates of clickable area are saved in xml file) It can be done quite easily with image map in applet. But I want to d

  • How to restore a previous version of lightroom database

    I messed up and mistakenly removed an image from lightroom ... is there any way to recover that version of the image that was in the lightroom database via a restore process? I've been backing up the database each time I start the program. Thanks.

  • Deactivating Adobe Acrobat 11

    I am creating system images for 4 different type of computers.  Usually what we would do is load the software on the machine then deactivate it so when the image is pushed out to the new machine we would use the serial that came with the machine to a

  • Marking Playing different iPod sections in iTunes

    Some talks that are formated as mp3 files for iPods that I have downloaded have sections like chapters. In iTunes 6 when playing such a file, these mp3 files would cause a tab for choosing sections to be visible to the right of the play window in the