What does the private keyword mean exactly?

Hi,
I thought I understood what "private" meant, but apparently not fully.
Can someone explain the difference between the following two chunks of code and why one compiles when the other doesn't?
class Component
  private Object loopID;
  private Container container;
  public boolean isActive()
    return loopID == container.loopID; //Doesn't Compile
    return loopID == getContainer().loopID; //Does compile
  public Container getContainer()
    return container;
class Container extends Component
}

Put simply, private means you can't access the
variable from outside
the class. So you cannot use the "." operator to get
access to it.
But the method can return a reference to it, so the
accessor method
allows you to return a reference to the variable.
Think of it this way:
If you want to do "x.y" or "x.y()", the
variable/method has to be public.
If the variable/method is private, you can't access
it with ".".
By the way, there is an edit button--It is in the
right corner above the message. I just added this
with it. I didn't know it was there before.
Message was edited by:
WhyNotFerzlePut simply: no. Private means that access is only allowed from within the body of the top level class where it the member or constructor is declared. Your example is just wrong on a number of levels. I can access the member of an instance using "." if I have access, and I cannot if I do not have access.

Similar Messages

  • I was playing with my ipad settings (it's an older model) and noted in the advanced settings of Safari there was a place to view website databases.  When I clicked on this I saw websites.  How do these get there and what does the space amount mean?

    I was playing with my ipad settings and noted in he advanced settings of Safari there was a place to view "website databases".  When I selected this I saw a multitude of websites.
    Can anyone tell me how these get there?  Can a website be posted even if it was never went to?  What does the space amount mean?  For example, 1.5 kb...is this quite a bit?  Would it indicate someone has gone to a site multiple times?
    I share my ipad with my teenage daughter and I'm trying to find out if she's lying to me.  Obviously she's swearing that she has "no idea" how these got there and I'm trying to keep her safe (she's only 14).
    Thanks everyone.
    Concerned Mom

    Think of your PC and the 'temporary internet folder' where it keeps cached copies of web pages or elements off a web page for 'quicker display the next time you visit'. That's pretty much what that folder is. 1.5K is tiny. Probably just a basic page with some text on it. (you might be confusing 1.5K with 1.5 megabyte....megabyte is large...it's roughly 1000 kilobytes, so the 1.5K is a tiny file)
    As far as I know, the only way info gets into that folder is if the browser has been to that site.
    if you have a concern there are browsers out there, McGruff is one i've seen recommended, that allow some degree of parental control and supervision. That or you could passcode lock the iPad or enable the restrictions to turn off some parts of the device to have some control.

  • What does the RHD symbol mean when using the multiple speakers?

    i have two 1st gen apple TVs and when i pull up the multiple speakers prompt, i see an acronym "RHD" after each device.
    what does the RHD symbol mean when using the multiple speakers?
    typically i was used to seeing the Apple TV-1  vs. Apple TV-1-RHD??
    What is the difference?

    It's been modified to run Remote HD.
    http://remotehd.com/

  • What does the "text item" mean in SD?

    what does the "text item" mean in SD?

    Is that Item Text?
    Please be clear in your questions.
    As this is your first post you should have a look at the [Rules of Engagement|https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/rulesofEngagement].
    Also interview questions are not allowed here.
    Regards
    Karthik D

  • What does the word Factory mean in "naming factory "

    What does the word Factory mean in "naming factory" in JNDI tech?

    A Factory class is a class that produces an instance of an object. For example, a ParserFactory class will have a method that returns a Parser. Usually this Factory class is looking at something in the environment to decide which object to return. "Factory" is just one of many "Design Patterns" that you will encounter in the programming world. Several (many?) books have been written about design patterns.

  • What does the plus sign (+ ) mean in the app store updates?

    What does the plus sign (+) mean in the upper corner of the app updates in the app store?  Does it mean it costs more money?

    No, it is free. I have yet to see a paid update. The + sign means it is a universal app, meaning that it works across iPad, iPhone and iPod touch.

  • What does the dotted circle mean?

    When connecting itouch to itunes, what does the dotted circle mean next to a song? Thanks for the help.

    Hi pfn,
    From an earlier post on this topic - this may work for you - it's worth a try:
    First go to the 'On This iPad/iPod/iPhone' section and note all the tracks that have dotted circles.
    In the 'Music' section, un-check/de-select all the tunes noted 
    Apply and sync the changes. 
    Once that completes re-check/re-select the same tunes just un-checked/de-selected in the 'Music' section.
    Apply and sync the changes again
    Go back into the 'On This iPad/iPod/iPhone' section
    Hopefully all the dotted circles will be gone and all the tracks can be played
    See if this helps!
    Cheers,
    GB

  • What does the apple sign mean when sometimes it shows ?

    What does the apple logo mean when sometimes i turn it on it just pops up and goes back to normal??

    Ayip,
    The Apple logo appearing on your iPod nano is your nano's start-up icon. Normally, when you turn off your iPod nano, you are really putting it into a deep or semi-deep sleep, where it is ready to turn on at the push of a button and resume where you left off in your Now Playing list.
    If, however, you leave your iPod in a sleep mode for some time , it will shut down. To turn it on again, you'll need to hit the center button (deep and semi-deep will wake up with any button press). When turning the iPod on from a shut down state, it will display the Apple logo while loading your music iPod software.
    Hope this helps!
    Sincerely,
    -FD

  • What does the exclamation point mean next to a song that is unchecked?

    what does the exclamtion point mean next to a song that is unchecked?

    If you hover over the exclamation mark (or you may need to click on it, I can't remeber), it should tell you. Usually, it means that the original file (for that song) cannot be found, either because it has been moved, renamed or deleted.

  • What does the following code mean???

    what does the following code mean ??
    fpm.raiseReviewAndSaveEvent(IFPM.EVENT_REVIEW, IFPM.EVENT_SAVE, vcFormEditButtons);
    thanks in advance.
    can you please tell me best site to learn WD4J coding.
    site having lot of WD4J code examples

    Hi,
    While Creating an FPM View we can use this line code.For more details of above line
    [code|http://help.sap.com/erp2005_ehp_04/helpdata/en/fc/ffd8464eb041848ca66749165d8f33/content.htm]
    Please look at these documents for WDJ Example Application. Please go through this documenst.
    [WDJ Application|Web Dynpro Java Tutorials and Samples NW 2004 ] and [Samples for Web Dynpro Java|http://www.sdn.sap.com/irj/sdn/index?rid=/webcontent/uuid/00b64d9f-fea2-2910-c988-ee2544047f8c] and [Web Dynpro for Java Demo Kit|http://wiki.sdn.sap.com/wiki/display/WDJava/WebDynproforJavaDemo+Kit]
    Hope this is help full for u
    Regards
    Vijay

  • What does the revert option mean when you hook an ipod touch up to the to itunes

    what does the revert option mean when you hook an ipod touch up to the to itunes?

    It means you changed some settings for how your iPod interacts with iTunes, you can either click Apply to confirm the changes, or Revert to undo them. This does not delete any content.

  • What does the green tick mean next to contact name

    PLease what does the green tick mean next to contact name ...

    In what app are you seeing a green tick next to a contact name?
    In many messaging apps, that means the contact is online/available.

  • What does the blue symbol mean next to the film mean

    What does the blue symbol mean next to the film mean?

    Welcome to the Apple Community.
    A full blue circle means it is unwatched, a half blue circle means you have started to watch it, but haven't finished it.

  • HT4061 what does the apple icon mean when its the only thing that appears on the screen

    what does the apple symbol mean when its the only thing that appears on the screen

    That yur iPod is sick
    Try the following to fix:
    - iOS: Not responding or does not turn on
    - Also try DFU mode after try recovery mode
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
    - If not successful and you can't fully turn the iOS device fully off, let the battery fully drain. After charging for an least an hour try the above again.
    - If still not successful that usually indicates a hardware problem and an appointment at the Genius Bar of an Apple store is in order.
    Apple Retail Store - Genius Bar       

  • What does the red bubble mean that is near the phone symbol and moves over to the vm symbol when phone is turned on

    What does the red bubble mean that appears near the phone symbol then moves over temporarly to the VM symbol, when first turning the phone on.  It goes away with a few seconds

    It means you have no signal, or if on the VM icon, it means to visual voicemail.  Sounds like you're just getting it temporarily until the phone establishes a signal.

Maybe you are looking for

  • I can't burn a disc from iTunes download....error 2131

    error message 2131 stops me from burning a disc from my recent iTunes download.  How can I get around this or fix this ......Windows XP.

  • I opened a spam email how do i know if it has caused a problem

    I opened a spam email and before i could delete it it went.  Also, when i had a financial page open on the internet, it looked like asomeone was trying to read it with a magnifying glass??

  • BUG : Creating Databound Hierarchy Search does not work in  11.1.2.1.0

    I've followed the example from Shay YouTube video and also from the development guide. "How to Create a Databound Search in a Hierarchy Viewer" http://docs.oracle.com/cd/E14571_01/web.1111/b31974/graphs_charts.htm#ADFFD22229 I drag and drop the Execu

  • How do i use apple gift card to pay on barclay card?

    i guess i screwed up, i got a apple gift card and for some reason i thought i could use it for payment on my new ipad mini I see nothing on barclay account except add bank account So am i now stuck with a 50 dollar gift card. Also sure wish i got 3 o

  • CATS_DA Report Authoraization

    Can some body guide me how to restricts CATS_DA T.code authorization at org. unit level. Here my requirement is when ever Org. unit chief execute this report he/she suppose to see his own employee data but not other org. unit employees data. So I wou