Why use "private"?

Hello Java experts,
My questions for today is: why should we use the "private" visibility modifier? isn't "protected" much better? when will we define instance variables as "private" and not "protected"? I can't find a good reason for doing so.
Thank You,
Maya.

The reason cannot be explaines in short & crisp manner .Read a good book on Object Oriented Programming. "private" is not to java alone but to all OO programming languages. If you need to protect your members (instance variables & methods) from other classes i.e( they can help only the enclosing class) it shouls be made private. This NOT at all the only reason!
Cheers
Sekar

Similar Messages

  • Why does Firefox 'remember' a login from my last session when, on both occasions, I was using "Private Browsing"?

    Why does Firefox 'remember' a login from my last session when, on both occasions, I was using "Private Browsing"? How do I stop this (without clearing other data)?

    Try disabling hardware acceleration. Many visual bugs can be attributed to issues with graphics drivers.
    (Firefox -> Options -> Advanced -> General -> [ ] Use hardware acceleration when available)

  • Why when using private browsing does Safari still remember websites visited?

    Even when private browsing is selected on my MacBook and iPad2, websites visited are remembered and displayed in history.  Why is this?

    Hi Graham,
    Welcome to the Support Communities!  Is it possible that you have some Safari windows open as private browsing, and others not?  See the overview of private browsing below (see the note I've highlighted in bold):
    Safari 8 (Yosemite): Use Private Browsing windows
    http://support.apple.com/kb/PH19216
    Use Private Browsing windows in Safari
    When you use Private Browsing windows, Safari doesn’t save your browsing history, and it asks websites you visit not to track you.
    Use Private Browsing:
    Choose File > New Private Window, or switch to a Safari window that’s already using Private Browsing. A window that’s using Private Browsing has a dark address and search field with white text.
    When you use a Private Browsing window:
    Each tab in the window is isolated from the others, so websites you view in one tab can’t track your browsing in other tabs.
    Safari doesn’t remember the webpages you visit or your AutoFill information.
    Safari doesn’t store your open webpages in iCloud, so they aren’t shown when you view all your open tabs from other devices.
    Your recent searches aren’t included in the results list when you use the address and search field.
    Items you download aren’t included in the downloads list. (The items do remain on your computer.
    Safari doesn’t remember changes to your cookies or other website data. Safari also asks websites and others who provide those sites with content (including advertisers) not to keep track of your browsing, although it is up to the websites to honor this request.
    Plug-ins that support Private Browsing stop storing cookies and other tracking information.
    Websites can’t modify information stored on your device, so services normally available at such sites may work differently until you turn off Private Browsing.
    Note:   None of the above applies in other Safari windows you may have open that don’t use Private Browsing.
    Stop using Private Browsing:
    Close the Private Browsing window, switch to a different Safari window that isn’t using Private Browsing, or choose File > New Window to open a window that doesn’t use Private Browsing. To further enhance privacy:
    Delete any items you downloaded while using Private Browsing windows.
    Close any other Private Browsing windows that are still open, to prevent others from using the Back and Forward buttons to see pages you visited in them.
    Besides using Private Browsing windows, you can manage cookies and data stored by all websites and have Safari ask all websites not to track you.
    If you forget to use a Private Browsing window, you can clear your browsing history.
    Last Modified: Jan 6, 2015
    Cheers,
    - Judy

  • Why is data being retained in the Firefox Internet cache when I always use Private Browsing ?

    OS Windows 7, using Firefox 33.1.1. I have set "Never remember history" so always use Private Browsing mode. I use CCleaner to delete unwanted files from my PC on each reboot, and notice that despite using private browsing mode CCleaner is deleting files every reboot from Firefox's Internet Cache. This morning, for example, there were 203 files with 2805 KB of data deleted by CC Cleaner from the Firefox Internet cache. What data is Firefox storing there from private browsing sessions?

    If you are in private browsing mode then the location for disk cache should be empty and show the same as the memory cache.
    Are you sure that this is the disk cache as there is more stored at the location where the disk cache is located?
    *C:\Users\<user>\AppData\Local\Mozilla\Firefox\Profiles\<profile>\
    Note that plugins may always store data on disk in their own cache.

  • Am I the only one that has safari restart every few minutes when using private browsing?

    I have no idea why, but when I use private browsing on safari, it seems to have a mind of it's own once and a while. Randomly, it decides to quit without the "quit unexpectidly" part normally found in this issue, and when I go back onto safari, all of the tabs I had open are no longer there.

    Nope, that's all I use is Private browsing on it and it's never behaved this way.

  • Safari loads and the crashes after using Private Browsing

    I am finding that Safari won't load after using private browsing. After switching off private browsing, I load Safari but as soon as it appears on the screen, it crashes. No matter how many times I start it up, it will always disappera.
    The only way to fix it is to shut down and then start up the iPad again.
    Anyone know why this is happening?

    If you search the discussion site, you will find a number of threads regarding crashing issues with Safari since the iOS 5 update. It seems to be more prevalent in the iPad 1 - which I have and I experience crashes as well - but I have seen no definitive solution.
    I have read that from some users that you should turn off bookmark syncing with iCloud, turn off private browsing, restart the iPad .... but nothing I have tried has eliminated the problem.
    For now, it seems to be - whatever works for you is the "fix" until it really gets fixed.

  • Why use Oracle 8.1.5 for Linux?

    Dear,
    If it is really pain in the ass to install Oracle on Linux, why
    use it? I have spent more than 4 full days (more than what I
    excepted) to try to install Oracle on a Linux box.
    I guess I will go for mySQL since I can just install the RPM
    package and do not have to worry those critical issues.
    Just a note for Oracle, please design a better Installer next
    time which is going to work! Thank you.
    Best Regards,
    Alex Yu
    null

    I have some sympathy for your plight. I have 8.0.5 installed on
    RedHat Linux. Apart from patching the Pro*C configuration file,
    everything is fine.
    It does seem 8.1.5 is more problematic. If you're purely
    evaluating Oracle, maybe you should consider 8.0.5 until 8i
    stabilises unless you really are gagging for some 8i feature.
    Alex Yu (guest) wrote:
    : Dear,
    : If it is really pain in the ass to install Oracle on Linux, why
    : use it? I have spent more than 4 full days (more than what I
    : excepted) to try to install Oracle on a Linux box.
    : I guess I will go for mySQL since I can just install the RPM
    : package and do not have to worry those critical issues.
    : Just a note for Oracle, please design a better Installer next
    : time which is going to work! Thank you.
    : Best Regards,
    : Alex Yu
    null

  • Why Using Top Link is best in DB Adapter?

    Hi All,
    Can any one suggest , Why Using Top Link (Build-in Insert, Select etc. operation) is best in DB Adapter over using custom query?
    Thanks

    Hi Vikky,
    for insert/select it depends on what kind of user you are. TopLink lets you browse and click on a tables and have everything generated for you. If you are more a DBA or show me the SQL type then you can just type SQL directly.
    Some advantages of TopLink would be:
    -The range of SQL generated by TopLink is limited, but if you hard code complex SQL into your service you need to maintain it.
    -TopLink can generate at runtime the correct SQL for a given database, making switching from say DB2 to Oracle easy.
    -The merge operation will compare the input XML to the columns on the database and update only what has changed. It can also do a sparse merge. If only 4 columns in the XML were set, only those 4 columns in the database will be updated.
    -For inbound polling the strategy used (LogicalDelete, Sequencing Table, etc) is a configuration property and then at runtime multiple SQL statements are generated. The SQL also takes advantage of advanced syntax like the Oracle-only FOR UPDATE SKIP LOCKED, writing it all yourself may be tedious and error prone.
    -The main benefit of TopLink is when you go beyond thinking about a single table. If you import multiple related tables at once, TopLink will generate the SQL to select from and maintain multiple tables, establish a commit order, and generate a hierarchical XSD. With custom SQL the matching XSD is always flat. I.e. if you just need to insert an emp you could get away with custom SQL. If you need to insert a dept and emps, I would use TopLink.
    -This is also when the intermediary abstraction of an object/table makes more sense, as you only need to import a complex relational schema once, then generate inserts, selects, etc.
    So I hope that helps. They are each equally viable and can do something that the other can't. Where you see an overlap I would go with personal preference.
    Thanks
    Steve

  • When using private browsing to view image results in Safari 5.1.3, only the first two rows of results are visible, the following four or so rows display greyed out place holders, and the safe search button is inoperable. Suggestions?

    When using private browsing to view image results in Safari 5.1.3, only the first two rows of results are visible, the following four or so rows display greyed out place holders, the remainder of the results page is blank, and the safe search button is inoperable. When I turn off private browsing and refresh the page, everything works again.
    Anyone else having this problem?

    I have got the same behaviour after the last Safari Update to 5.1.3. It seems that Safari now handles some scripts in a new way. If you debug the Google Website, you will see, that there is some Javascript Error, that seems to prevent to write into local cache. After some searching I wasn't able to finde a solution for this problem, other then disabling Javascript while private browsing to prevent the script loading. You then are able to use Google with the old layout. The option to disable JavaScript can be found in the Menu "Developer", wich has to be enabled in Safari in the options first.
    In my opinion this is a bug that is now occuring, because Apple changed something in private browsing and that has to be fixed by Google now, to run again. Or we will have to wait for 5.1.4, as you can read online Apple will change and bugfix the javascript engine in that version, perhaps this fixes the problem as well. I hope so!
    If anyone is in the developer program perhaps you could test this with the beta of 5.1.4 and tell us if it works.

  • Why use interlaced ?

    We shoot with DVCpro50 at 24p.
    A few questions.
    1. Is there anytime that there is an advantage, or a time when you have to use field dominance ?
    Interlaced footage looks like crap. Stills look horrible in an interlaced timeline - why ever use it ?
    It seems I can just switch the field dominance from "lower/even" to "none" and everything looks 10 times better on computer and NTSC monitor.
    2. Is there anytime that there is a disadvantage to removing the pulldown and editing in 24fps. It looks 10 times better without the screwd up "B/C & C/D" frames if you leave it in and edit at 29.97fps.
    3. is there any advantage or quality enhancement by removing the pulldown in "Shake" rather than letting FCP do it while capturing. And after removing, should your sequence timeline be set to 24fps or 23.98fps and why ?
    4. Have G5, OSX 10.4.8, AJA IO hooked up to NTSC monitor, and can't view 24fps timeline on external NTSC monitor - only frames when parked - is that because these monitors will only accept 29.97 field dominated footage ?

    Fist off - thanks for the help on part 4.
    I know how TV works and why NTSC was invented over a half century ago.
    Now that I can monitor on the external I will always edit in 24. I'm only the editor - they shoot with a SPX900 in 24p - if you don't remove the pulldown, frames 3 & 4 out of the 5 frame cycle combined with the interlacing gives really bad results. So out of curiosity I switched the sequence dominance setting from "lower/even" to "none" - at this point is ii still treated as interlaced or if it is set to "none" is it now progressive, like when you are editing in 24 and the field dominance window is greyed out. I would think that this would look jittery on a TV because the field order isn't right - but it doesn't - I can make DVD, VHS(not sure why), and monitor and the only difference is that the stills look incredibly better - there's no banding and stair stepping on the shoulders- on either the computer monitor or the NTSC monitor. And with it set to "lower/even" the bigger the computer or TV screen the worse it looks - but with it set to "none" the stills just get softer as you view them on bigger screens as if the right amount of gaussian blur was being added automatically - Isn't that wht you want ?
    So that was why I ask "why use interlace" if you have a choice?
    I'm not trying to be cool - these are ligitimate questions. I consider this doing my homework - isn't that what forums are for - I help people with answers all of the time.
    As for part 3 - Does "standard pulldown" refer to going back & forth between 24fps (film) and 29.97 (video) and "advanced pulldown" from 23.98 to 29.97 ?
    Are all of these modern video cameras actually shooting at 23.98 ?
    2 G5s 1.8Ghz single & 2.7Ghz Dual (PPC)   Mac OS X (10.4.8)   FCP Studio 5.0.4, Shake 4.1, AJA IO, 1.5G RAM & 3G RAM
    2 G5s 1.8Ghz single & 2.7Ghz Dual (PPC)   Mac OS X (10.4.8)   FCP Studio 5.0.4, Shake 4.1, AJA IO, 1.5G RAM & 3G RAM

  • Using -private in conjunction with -new-window isn't working correctly

    Using an external program to launch Firefox with command line arguments, it seems that using -private and -new-window URL doesn't seem to work correctly. It's almost as if one or the other gets completely ignored. Has anyone else noticed this?
    Ideally, i'd like to be able to ALWAYS launch a new window to a specified URL in private mode by default.

    It is not possible to open an external link in a Private Browsing mode window.
    You can look at this extension:
    *Private Tab: https://addons.mozilla.org/firefox/addon/private-tab/
    The Firefox menu button gets a purple background or you get a purple PB mask on the Menu bar or tab bar (Linux) when you are in a PB tab and all Private Browsing mode tabs get a dashed underlining unless you are in permanent PB mode.
    You can set the extensions.privateTab.allowOpenExternalLinksInPrivateTabs pref to true on the <b>about:config</b> page to see if that works (haven't tested this with a command line).

  • When using private browsing, I cannot bring up my list of favourites

    I've recently had installed Firefox, previously Internet Explorer.
    When i'm using Private Browsing, i'm unable to bring up my list of favourites. or as an alternative, can I view web sites as use the tools option, Internet options and then delete, delete , OK..
    Thx

    Are toolbars hidden?
    Press F10 or press and hold the Alt key down to bring up the "Menu Bar" temporarily.<br />
    Use View > Toolbars to select which toolbars to display.
    There are other things that need your attention.
    Your above posted system details show outdated plugin(s) with known security and stability risks that you should update.
    # Macromedia Shockwave for Director Netscape plug-in, version 8.5
    # Shockwave Flash 6.0 r79
    # Next Generation Java Plug-in 1.6.0_22 for Mozilla browsers
    Update the [[Managing the Flash plugin|Flash]] plugin to the latest version.<br />
    You can check if there is a file NPSWF32.DLL in the C:\Program Files\Mozilla Firefox\plugins folder and remove that file.
    *http://kb.mozillazine.org/Flash
    *http://www.adobe.com/software/flash/about/
    Update the [[Using the Shockwave plugin with Firefox|Shockwave for Director]] plugin to the latest version.<br>
    *http://www.adobe.com/shockwave/welcome/
    Update the [[Using the Java plugin with Firefox|Java]] plugin to the latest version.
    *http://kb.mozillazine.org/Java
    *http://www.oracle.com/technetwork/java/javase/downloads/index.html (Java Platform: Download JRE)

  • Why use symbol {   } in the following script?

    Why use symbol *{   }* in the following script?
    <read-write-backing-map-scheme>
    <scheme-name>SampleDatabaseScheme</scheme-name>
    <internal-cache-scheme>
    <local-scheme>
    <scheme-ref>SampleMemoryScheme</scheme-ref>
    </local-scheme>
    </internal-cache-scheme>
    <cachestore-scheme>
    <class-scheme>
    <class-name>com.tangosol.examples.coherence.DBCacheStore</class-name>
    <init-params>
    <init-param>
    <param-type>java.lang.String</param-type>
    *<param-value>{cache-name}</param-value>*
    </init-param>
    </init-params>
    </class-scheme>
    </cachestore-scheme>
    </read-write-backing-map-scheme>
    Thank you very much
    Edited by: jetq on Jun 24, 2009 6:26 PM

    Hi Frank,
    In the example, the "{cache-name}" is supposed to be replaced by the database's table or view name that will be queried for the data to be cached. It's purpose is demonstrate how to pass parameters to the class constructor.
    Regards,
    Harv

  • Why use layer masks and adjustment layers?

    I've been using PSE and CS successfully for years.
    One thing I have never understood is: why use layer masks and adjustment layers, instead of simply creating a copy of the subject layer (the one I want to make changes to) and experimenting with that?  It's quick (Ctrl-J), I can do it as many times as I want, I'm not affecting my Background layer.  If I like the changes, I can keep them.  I can switch the copy on and off to compare with the Background layer.  I can do any type of blend or combination I desire.  I can insert Gradient layer(s), select any part of the copy and (Ctrl-J) create a new layer containing only the selected part.  I can adjust size, rotate, do anything.
    It almost seems that "layer mask" and "adjustment layer" are mainly another layer of terminology; can anyone explain (preferably in 50 words or less) how they are intrinsically different from or superior to working with copies of the Background layer?  What can be done with them that can't be done simply using copies of the Background layer?

    Here's a very basic example of the advantage of using a layer mask.
    I have this picture of a sunflower and I want to convert the background to black & white, leaving just the flower in color.  I duplicated the Background layer, converted it to B&W and proceeded to use the Eraser to uncover the flower color. But I made a mistake and erased outside the flower.  There is no way to correct this other than deleting the layer and starting again.
    Now let's use a layer mask on the B&W layer. Set the Foreground/Background colors to the defaults black/white. Using the Brush tool paint on the mask with black to reveal the color.  Here I painted too far, revealing a green leaf in the background.  No need to start over.  Simply switch to white and paint the excess to convert back to the B&W.
    Tip: while painting you can type "X" to toggle between black and white.
    You could also select the flower using the various selection tools and then fill the selection with black. If it turns out the selection was not 100% accurate you can then fine-tune the result by painting on the mask with black or white as necessary.

  • Why using workarea for internal table is better in performance

    Please tell me
    why using workarea for internal table is better in performance

    Hi Vineet ,
      Why would we choose to use an internal table without a header line when it is easier to code one  with a header line?
    it has following reason.
    1)Separate Internal Table Work Area:
         The work area (staging area) defined for the internal table   is not limited to use with just one internal table.
    take ex-
    Suppose you want two internal tables for EMPLOYEE – one to contain all records and one to contain only those records where country = ‘USA’.  You could create both of these internal tables without header lines and use only one work area to load data into both of them. You would append all records from the work area into the first internal table.  You would conditionally append the ‘USA’ records from the same work area into the second internal table.
    2)  Performance Issues:  Using an internal table without a header line is more efficient than one  with a header line
    3) Nested Internal Tables:  If you want to include an internal table within a structure or another   internal table, you must use one without a header line.
    If this one is helpful ,then rewards me
    Regards
    Shambhu

Maybe you are looking for