Why does final keyword work differently with collection

I have tried final on StringBuffer but when i changed the value of StringBuffer object its throws a compile time error but when i did same thing with vector it work perfectly fine.
any one knows the reason? please send me in details.
final Vector v = new Vector();
v.add("String1");
v.add("String2");
final StringBuffer sb  = new StringBuffer();
sb = sb.append("xyz");

Because you haven't understood the keyword final. when you make a reference final you may not change the object to which it points to.
final StringBuffer sb  = new StringBuffer();This is valid because this is the first time you instatiate sb
sb = sb.append("xyz");this is invalid because you are trying to assign a new object to a reference that may only be assigned to once.
Compare
final int testInt = 1;
testInt = 2; //errorthe vector works because you do not assign vector reference v a new Vector object

Similar Messages

  • Why does VPN connection work differently in Windows 8.1 than in Windows 7?

    I have the following situation:
    I run a Windows 8.1 64-bit and Juniper VPN Client. There is a cable connected to my laptop and usually it shows Ethernet 2 (I'm connecting through a dock though that doesn't seem to be relevant) as the adapter with internet access. Now, when I connect to
    the VPN, the Juniper Virtual Adapter appears and it now has internet access. Ethernet 2 loses the privilege. 
    Now, meanwhile the guy sitting next to me running Windows 7 using the same VPN client and his adapters show the opposite, Ethernet has the internet access while the Juniper Virtual Adapter doesn't.
    This is a problem because this setup makes it impossible for me to use some inhouse applications which can only be accessed from the internal network. My hostname shows up as the place where I'm tunneling via VPN to. 
    I googled around a bit and found some workarounds, but none have worked so far (for example people seem to have the same problem with WiFi networks, but the corresponding hotfix doesn't work for cable).
    Any help is greatly appreciated.

    Hi,
    To find where your problem is, you can attempt to compare two route table with each other.
    Please open CMD by running as administrator, and type following command:
    route print
    If you are not familiar with this, you can upload the screenshot,or copy the content to notepad,then upload to SkyDrive.
    Regards,
    Kelvin hsu
    TechNet Community Support

  • Why does final cut x not recognize the sharp PN- K321 monitor ( European version ) as output video monitor and premiere it? Working with two cinema display and PN- K321 and I can not preview the output video at 4K for DisplayPort, whereas with premie

    Why does final cut x not recognize the sharp PN- K321 monitor ( European version ) as output video monitor, and premiere yes?
    Working with two cinema display and PN- K321 and I can not preview the output video at 4K by DisplayPort, whereas with premiere and after effects I have no problems

    Look, you can build an HD DVD with an SD movie, just as you can build an SD DVD with an HD movie. This is not a bug, it is most likely user error. Apple will not be addressing it.
    Just start over, and ensure you are building an SD DVD by bringing up the inspector for the disc (click on the background in the Graphical tab).
    Make sure SD DVD is selected:
    (If you do the same thing on your ill fated project, you'll see that HD DVD is selected)
    Build your DVD and you'll be fine.
    Patrick
    P.S. You will need to google HD DVD and Blu-Ray if you want to understand the difference between the formats. The reason that DVDSP included HD DVD was that its format was similar to SD DVD's. Blu-Ray is something else entirely.

  • Why does my iphone come up with a different email when updating apps?

    why does my iphone come up with a different email when updating apps?
    Everytime I go to update my apps some other persons email or AppleID comes up and I have to cancel.  its annoying enough to have to update all the time but now I have about100 update notifications (don't judge, you probably have a ton of apps too..haha) that are sitting idol, what's up how do I fix?
    thx
    Jackie
    p.s. not updating to iOS6 yet

    I'm sorry Allan, I should have clarified, your answer is improbable (well the first part atleast).
    The apps I have had since the first week of purchase of my iphone back in 2011,  I have not added any apps until 2 months before the last software update.  This starting happening when the new software was implemented but I have not updated to iOS6 yet.  Unless this person was able to hack into my account & transfer them to their account, I do not see how that is possible.
    Prior to seeing this other AppleID, I have a popup to prompt me for my AppleID each time I download content.  Each time I would see mine and enter my password.

  • I m coming from linux platform ... now need my g   to work with vim ... how to install g   which supports C  0x ... why does  not it has repository with apple ... its so easy rather than going to UI ...

    i m coming from linux platform ... now need my g   to work with vim ... how to install g   which supports C  0x ... why does  not it has repository with apple ... its so easy rather than going to UI ...

    tom i have been using ubuntu for c++ project
    i use lambda and atomic (c++0x) but now as I am working on MAC not able to use them
    installed xcode(4.3) and changed compiler settings to LLVM3.1 but still both features are not available
    to compile wanted to have g++ which supports c++0x features ...
    new to MAC (2-3 days) so was in rush to solution
    let me know if you have some suggestion ...
    else will try with eclipse cdt .... 

  • I dropped my iphone 3gs in water and grabbed it immediately out. It gave me a charger is not supported with device screen every minute or two. I powered it off for the night. I havent experienced problems since. Why does it still work?

    I dropped my iphone 3gs in water and grabbed it immediately out. It gave me a charger not supported sign every minute or two. I decided to turn it off for the night and the next morning it worked fine and only the bottom sensor was triggered. Why does it still work and how long will it last?

    Water in itself will not kill electronic components if you let it dry out.  Your first reaction to turn it off was a good one but you could have waited even longer.
    It also depends what's on your water that will stay after the water itself had dried; like salt. Anything that iseither acid or conductor left on the circuit board will reduce the life of the board.  Given said this, no one could state how long your iPhone will work since no one will know for sure where the water had time to infiltrate before you removed your device and no one what's may left there.
    Consider yourself lucky.  I don't understand however what you mean by a sensor triggered.

  • Why does Firefox not work here in China anymore, since January of 2015?

    I have used Firefox for years, as the fastest and most reliable browser for me, esp in China... not anymore! Last month (unknown to me) a hijacker called Vosteran took over my Firefox browser. I finally realized it and got it cleaned up using Malwarebytes anti-malware, and downloaded a new Firefox... now SAME problem exists, even with Vosteran removed!
    Firefox will not allow me into ANY normal sites, saying they don't have the proper security code. This includes my Yahoo front page, email account, ESPN and other common sites that are certainly NOT dangerous. So, WHY does Firefox not work anymore? It is useless to me here in China the way it works now.

    hello rickinchina, first please make sure that the '''date, time & timezone''' are set correctly on your system and that firefox is set to directly connect to the internet (that's the "'''no proxy'''" setting in the firefox ''menu ≡ > options > advanced > network > connection - settings...'').
    if this doesn't solve the issue (or it is already set properly), a possible solution depends on different factors:
    * what is the '''error code''' shown under ''technical details'' on the error page?
    in case the error code equals ''sec_error_unknown_issuer'', please attempt to add an exception on the bottom of the error page (but don't do it for real) and inspect the certificate (see the screenshot attached for instructions):
    * which '''issuer information''' does the certificate contain?
    please report back with those two pieces of information. thank you!

  • Why does Adobe sendnow work and the newest and greatest Adobe Send does not work?

    Why does Adobe sendnow work and the newest and greatest Adobe Send does not work? I wasted about 8 hours on trying to get Adobe Send to upload 269 files that amounted to 469MB. When it did not work I made a zip file and after a lot of wasted run time that did not work. The first situation gives little indication of when a file is loaded compared to Adobe SendNow. In both cases with Send it failed with a message like only the first 50 can be loaded. When I went and looked none of them had been loaded. With the zip file (I wanted to hide the individual files so they would not be counted) it appeared to work but very slowly and finally said it was done and I went and looked and it had done anything for oever 2 hours except a false "I'm runninng" indication.
    Thus, I took a chance with Adobe SendNow and it works great. It never gave me a limit on the amount of files nor on the size of the complete job. It shows me one file at a time when it has finished with the file uploading it. SendNow has never given me any problems.
    Why woiuld you want to change the program from SendNow to Send without the newest program being the best, fastest, user friendly program of the two? It just doesn't make sense to me. I suggest that Adobe keep SendNow working until Send is fixed. I would also suggest that SendNow and how it looks be kept, called Send, then modify Send one thing at a time until you get it to the point you need it to be for Acrobat. I have heard nothing good and now I have experienced it that Send is a piece of junk. I wasted most of my work day on giving Adobe the benefit of the doubt to find out I made a very bad decision to trust Adobe to make good decisions on the transfer of a function to another place .... both Adobe's responsibility.without making it painless for your customers that totally rely on you. Don't throw away customer confidence as it is very hard to get it back.

    Funny how you answer to "troll". (What's your handle on AT&T forums?)
    Yep! Verizon living up to it's contractual obligations by not releasing updates. Caveat emptor!
    I think there are some reasonable expectations here to keep customer's happy. When one carrier offers upgrades there is an expectation the same will happen across all the carriers. We have seen that except Big Red.
    Verizon could have said the update is in MS court months ago and stilled the voice of the disgruntled, or at least redirected it, but instead chose to be silent. Not for market share but for partial blame I think.
    We will have to agree to disagree since you only see Terms & Conditions and I, see customer satisfaction.

  • Why does abode not work on my galaxy tab2

    Why does abode not work on my galaxy tab 2?

    The games dont load they just say I need to update to the latest version or say that it is not compaterble with it.

  • Team Blog: Why does my page look different in BrowserLab?

    Duane O'Brien, engineer on the BrowserLab team has a new blog post on the BrowserLab Team blog that you might find interesting. It covers when/why you might see rendering differences between the BrowserLab browsers and your local browsers. Good info.
    http://blogs.adobe.com/browserlab/2011/07/11/why-does-my-page-look-different-in-browserlab /
    Bruce
    Bruce Bowman
    BrowserLab product manager
    BrowserLab Team Blog: http://blogs.adobe.com/browserlab
    Twitter: @brucebowman, @adobebrowserlab

    As Wyodor indicated IE is not the most advance, up-to-date browser out there.
    See Roddy’s tips for making iWeb pages more compatible with IE.
    OT

  • Why does Illustrator CS4 save pdfs with clipping paths and make rasters of gradient areas

    I am on a IMAC and upgraded to 10.6.8 Jan 2014. I am using CS4 Illustrator to create with. When i save my work as a pdf then reopen the pdf in Ill to make changes, the whole page has:
    A.) Multiple clipping paths around it
    B.) Most text has now become outlined. Not editable anymore.
    C.) Gradient areas have multiple clipping paths of the single gradient area
    D.) The gradient areas now become rasterized.
    This is very frustrating as now all of my marketing files, some 300+, are worthless. I don't know where to look anymore to find the problem.
    Please help.
    Thank you very much

    John,
    I have the presets as you have shown. I had been editing the supplied items as you suggested. Then figured i should ask the questions of those who are better than I.
    But still a bit confused as to why the new save places clipping paths around the document.
    Thank you John and Monika for your help.
    why does Illustrator CS4 save pdfs with clipping paths and make rasters of gradient areas
    created by John Mensinger in Illustrator - View the full discussion
    I do a save as "pdf" in the format pull down tab. I save to a folder on the hard drive. Where is the "Illustrator editability" check box? I presumed it is in Acrobat some where
    but i seem to be lost.
    It is in Illustrator's Save Adobe PDF dialog, which pops up before the saved file is written.
    https://forums.adobe.com/servlet/JiveServlet/downloadImage/2-6439399-644928/450-397/Untitl ed-1.jpg
    Sorry i didn't mention this, but this seems to have occurred when using images and text from provided pdfs.
    That's a critical fact. If you didn't do the original save, the above is moot, and it's too late to exercise any control over the save process. Someone else failed to save for editability. The only thing you can do is clean up/repair the content, (release clipping masks, rebuild rasterized elements, expand objects, etc.), and save correctly as AI. Then, if necessary, re-save as PDF with the correct settings.
    Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at https://forums.adobe.com/message/6439399#6439399
    Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page:
    To unsubscribe from this thread, please visit the message page at . In the Actions box on the right, click the Stop Email Notifications link.
    Start a new discussion in Illustrator by email or at Adobe Community
    For more information about maintaining your forum email notifications please go to http://forums.adobe.com/thread/416458?tstart=0.

  • Why does mail stop working?

    Why does mail stop working when it has worked fine for years?

    OK, thank you.  I use apple for e-mail.  I have an @me address and I have long subscribed to mobile me, which has recently become icloud.  Yesterday the @me mail account appeared to stop recognizing my e-mail password for my primary mail account on my two imacs but not on my ipad.  The most recent e-mail I have received on my imacs is 7:16am yesterday, but I know from my ipad that I have received numerous e-mails since then.  I have other mail accounts, including one for the school where I teach.  I am receiving e-mail on the school account ok.
    I made no changes to my password or otherwise for my primary mail account any time recently.  I also still have my @mac address.
    Generally, I do not understand icloud.  I do not understand how to sync information across computers.
    When I go to preferences in mail and I click and accounts and account information, I do not understand anything that I see there.  When I try to re-type my password, there seems to be no way to save it except to switch to another mail account.  I know from past experience that if I attempt to fix whatever might be wrong with mail I do not know what I am doing.
    Any information would be helpful.  Thank you.

  • Why does my eprinter work sometimes then stops working

    why does my eprinter work sometimes then stops working, its like it shows the printer page, there are the two different types one that pops up when you hit the print button then the one that pop up when you go too printer , they are two different types why?

    Hi there Michelle047;
    Are you having perfomance issue and is this still happening?
    What operting system are you using? i.e. use this example Win 7 64 bits. SP1
    Let me know and please clarify further your question I will do my best help you .
    Regards;
    RobertoR
    ▼ 
    You can say THANKS by clicking the KUDOS STAR. If my suggestion resolves your issue Mark as a "SOLUTION" this way others can benefit Thanks in Advance!

  • Why does Itunes stop working when I start to play a movie

    Why does Itunes stop working when I start to play a preview or watch a downloaded movie rental

    Let's try the following user tip with that one:
    iTunes for Windows 10.7.0.21: "iTunes has stopped working" error messages when playing videos, video podcasts, movies and TV shows

  • Why does't Flashplayer work after I agreed to an update from an Adobe pop-up box prompt?

    I had problems last year when Flashplayer stopped working suddenly.  After months of seeking help, I received instructions that fixed the problem...until the other day.  A pop-up box from Adobe appeared indicating an update was available.  I agreed to installing the update and the Flashplayer has not worked since.  I referred to my notes from the "fix" last year and made one adjustment in the Active-X settings, but this did not help.  Flashplayer still does not work.  Help!  I just don't think I can go through this for several months again.

    Hi,
    I am going to try reorganizing my reply first and
    just forwarding to you before I try to recover a
    message.  I think the problem may be that I
    provided answers within your text instead of
    separately.  Your system may not like the format
    I tried.  So here goes....  I have pulled my
    answers out of your message and they appear in
    the order of your inquiries below.
    “Check the Windows system tray carefully to make
    certain no applications are still in memory which
    might possibly use Flash Player.” –a statement
    from the Adobe Un-install link article.  I don't
    know what “in memory” means.  The only things I
    have that may use Flashplayer that I know of is
    the Weather Bug.  Windows Mediaplayer is also
    listed in my programs, but I have never used it.
    Also, there is no mention of Norton here, but
    Norton Internet Security ’09 is what I have installed.
    1. No Firefox.  MSN Exlorer is listed among my
    Programs, but I have never used it.  It was
    likely installed by Dell when I purchased the computer.
    2. Norton Internet Security '09.  Bell Internet
    Security - Alert is listed in my programs (with
    options, including uninstall) but this is the first time I have noticed it.
    3. Norton Internet Security has a firewall with
    it that I understand is way better than Windows.
    4. There is a Google toolbar, Norton toolbar and
    a bunch of stuff listed in the Manage Add-ons
    like Skype, Adobe and Sun Java Console which I think are add-ons.
    Java Webstart is listed under Accessories in
    Programs.  In Programs is Adobe Distiller 6.0,
    Adobe Acrobat 6.0 Standard, Adobe (which is
    empty), Adobe.com and Adobe Reader 9.  I did not find DLM or GetPlus.
    I found no listing for Shockwave Flash
    Object.  You did not ask this and I don't mean to
    get ahead of you but in case there is relevance,
    I looked in Internet Options, Security, Custom
    and saw a number of reference to Active X and
    plug-ins, some of which are disabled; others enabled.
    From reading in your posts to mlmarg, I saw the
    instructions for finding the Flash folder and
    used them.  I used Explorer to access My
    Computer,, C Drive, Folder 1386, Folder System
    32.  There are 2 items in it from 2002 but not
    what I think you want.  The 2 are SMSS.EXE and
    NTDLL.DLL.  If this is not correct, I will need your instructions to locate it.
      I will ask because I don't always understand
    what you are asking of  me.  Thanks.
    >Date: Thu, 21 Jan 2010 14:23:36 -0500
    >To: [email protected]
    >Subject: Re: Flash Player Why does't
    >Flashplayer work after I agreed to an update from an Adobe pop-up box prompt?
    >
    >Hi,
    >My comments are within your text below.  Let me
    >know what I missed or misunderstood.

Maybe you are looking for