Can you  say internally what happens?

String s1 = new String("ABCDEF");
String s2 = new String("ABCDEF");
if(s1==s2){
s.o.pln("true")
}else
s.o.pln("false")
} here it gives false
String a="xxxxx";
String b="xxxxx";
if(s1==s2){
s.o.pln("true")
}else
s.o.pln("false")
} here it gives true

I'm not completely certain about this, but based on some of the Java certifications facts, this is what I believe it happens:
For:
String s1 = new String("ABCDEF");
String s2 = new String("ABCDEF");What happens first is that when the code reaches the first object creation, it FIRST creates the String "ABCDEF" and places it on the java pool of Strings, then your two String references (s1 and s2) points to a new String object which has a reference to the "ABCDEF" String.
A more graphical representation would look like
[String s1] ---> [String obj] ---\         //Pool
                                  \------ [ "ABCDEF" ]
[String s2] ---> [String obj] ---/So, when you compare s1 to s2 using the "==" operator (you are comparing the references, not the value) it returns false,
because s1 and s2 point to different objects, even though they have the same value.
Now
For:
String a="xxxxx";
String b="xxxxx";What happens is that when the code reaches the first object creation, it FIRST creates the String "xxxxx" and places it on the pool, then both references (a, b) point directly to that String object in the pool.
Graphically:
[String a] ---\         //Pool
               \------ [ "xxxxx" ]
[String b] ---/So now, both, a and b point to the same object and that is why the comparison using the "==" operator returns true.

Similar Messages

  • My Mac says i do not have sufficient permission,( though I've repaired permissions and checked that I'm an administrator of this computer) to upgrade- can you tell me what the problem is? Mac 10.5.8

    My Mac says i do not have sufficient permission,( though I've repaired permissions and checked that I'm an administrator of this computer) to upgrade- can you tell me what the problem is? Mac 10.5.8
    == This happened ==
    Every time Firefox opened
    == I attempted to upgrade from 2.0 version ==
    == User Agent ==
    Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_8; en-us) AppleWebKit/533.16 (KHTML, like Gecko) Version/5.0 Safari/533.16

    See http://kb.mozillazine.org/Installing_Firefox#Mac_OS_X
    If you have Mac OS X 10.5 or newer then do this:
    Download a new copy of the Firefox program: http://www.mozilla.com/firefox/all.html
    Trash the current Firefox application to do a clean reinstall.
    Install the new version that you have downloaded.
    Your profile data is stored elsewhere in the [http://kb.mozillazine.org/Profile_folder_-_Firefox Firefox Profile Folder], so you won't lose your bookmarks and other personal data.

  • Help! We have a form with more than 200 entries and when I looked at it yesterday it had one! When you download the form to excel they all show up. However, when I added another record today it disappeared. Can you tell me what's happening? I've been usin

    Help! We have a form with more than 200 entries and when I looked at it yesterday it had one! When you download the form to excel they all show up. However, when I added another record today it disappeared. Can you tell me what's happening? I've been using adobe forms for 2 years with mass response feedback and have never had this problem.

    Greetings,
    I've never seen this issue, and I handle many iPads, of all versions. WiFi issues are generally local to the WiFi router - they are not all of the same quality, range, immunity to interference, etc. You have distance, building construction, and the biggie - interference.
    At home, I use Apple routers, and have no issues with any of my WiFi enabled devices, computers, mobile devices, etc - even the lowly PeeCees. I have locations where I have Juniper Networks, as well as Aruba, and a few Netgears - all of them work as they should.
    The cheaper routers, Linksys, D-Link, Seimens home units, and many other no name devices have caused issues of various kinds, and even connectivity.
    I have no idea what Starbucks uses, but I always have a good connection, and I go there nearly every morning and get some work done, as well as play.
    You could try changing channels, 2.4 to 5 Gigs, changing locations of the router. I have had to do all of these at one time or another over the many years that I have been a Network Engineer.
    Good Luck - Cheers,
    M.

  • I am using Mavericks. I had a list of VIPS and used it extensively. Now it has disappeared and VIPs on the menu bar is faded. There is nil response to VIP in help. Can you tell me what has happened?

    I am using Mavericks. In Mail I had a list of VIPS and used it extensively. Now it has disappeared and VIPs on the menu bar is faded. There is nil response to VIP in help. Can you tell me what has happened?

    Triple-click anywhere in the line below on this page to select it:
    ~/Library/Mail/V2/MailData/VIPSenders.plist
    Right-click or control-click the highlighted line and select
    Services ▹ Show Info in Finder (or just Show Info)
    from the contextual menu.* An Info dialog should open.
    Does the dialog show "You can read and write" in the Sharing & Permissions section?
    In the General section, is the box labeled Locked checked?
    What is the Modified date?
    If you don't have read and write access to the item, change the settings as directed here. Note, however, that if one file has wrong access settings, most likely others do as well. If the item is locked, unlock it.
    *If you don't see the contextual menu item, copy the selected text to the Clipboard by pressing the key combination command-C. Open a TextEdit window and paste into it (command-V). Select the line you just pasted and continue as above.

  • I was trying purchase something it says contact to apple  can you tell me what's going on?

    I was trying purchase something it says contact to apple  can you tell me what's going on?

    Do you mean it said to contact iTunes? If it says either one of those then you need to call apple support, and get them to look at your account.

  • Can you tell me what to do? "This iPad has not been backed up in 4 weeks.Back ups happen when this iPad is plugged in locked and connected to Wi-Fi" What do I do?

    Can you tell me what I should do? My iPad shows the following message, " This iPad has not been backed up in 4 weeks. Back ups happen when this iPad is plugged in locked and connected to Wi-Fi"  Thank you in anticipation you will be able to help me, Ray Mill.

    Try a reset. Hold the Sleep and Home button down (together) for about 10 seconds until you see the Apple logo. Ignore the red slider.

  • I have the old iphone 3g i need to update whatsapp it says i require iOS 4.3 can you tell me what i need to do ?

    I have the old iphone 3g and i need to update whatsapp it says i require iOS 4 can you tell me what I need to do please ? I dont have the software button as it states in the instructions help!

    The iPhone 3G can not be upgraded beyond iOS 4.2.1.

  • I am an international student studying in Kettering University, US and i have an isic that is international student identity card. Can you tell me what is the procedure to claim for a discount by using my isic. Want to buy ipad air 2 for education.

    I am an international student studying in Kettering University, US and i have an isic that is international student identity card. Can you tell me what is the procedure to claim for a discount by using my isic. Want to buy ipad air 2 for education.

    Welcome to the US!  I think you can just take your ID card to the Apple store or shop online : http://store.apple.com/us/browse/campaigns/education_pricing
    the site has all the info for eligibility and available items for purchase -- I think you can type in your school to see if on list of approved schools. I think the ID checking is rather benign. discounts are modest from what I recall.

  • I have an Iphone 4 16gb and updated the IOS 6.1.2. after the update my 3G is not working at all??. can you please suggest what can be done to rectify this problem?

    i have an Iphone 4 16gb and updated the IOS 6.1.2. after the update my 3G is not working at all??. can you please suggest what can be done to rectify this problem?

    I have the same problem.  After updating to 6.1.2 my iPad 3,2 will not find Verizon network.  It just says "Searching..." for ever.  Any thoughts?

  • I installed Adobe CC months ago. uninstalled it.. said "with errors" now I cannot reinstall Adobe CC... can anyone tell me what happened so that my money doesn't go to waste?

    Uninstalll error. Cannot reinstall. what happened here and how do I fix this?

    No one can tell you anything about what happened until you give complete details.
    Maybe someone could help you fix your issue.
    BOILERPLATE TEXT:
    Note that this is boilerplate text.
    If you give complete and detailed information about your setup and the issue at hand,
    such as your platform (Mac or Win),
    exact versions of your OS, of Photoshop (not just "CS6", but something like CS6v.13.0.6) and of Bridge,
    your settings in Photoshop > Preference > Performance
    the type of file you were working on,
    machine specs, such as total installed RAM, scratch file HDs, total available HD space, video card specs, including total VRAM installed,
    what troubleshooting steps you have taken so far,
    what error message(s) you receive,
    if having issues opening raw files also the exact camera make and model that generated them,
    if you're having printing issues, indicate the exact make and model of your printer, paper size, image dimensions in pixels (so many pixels wide by so many pixels high). if going through a RIP, specify that too.
    etc.,
    someone may be able to help you (not necessarily this poster).
    a screen shot of your settings or of the image could be very helpful too.
    Please read this FAQ for advice on how to ask your questions correctly for quicker and better answers:
    http://forums.adobe.com/thread/419981?tstart=0
    Thanks!

  • How can you find out what generation your iPod touch is?

    How can you find out what generation your iPod touch is?

    Hi,
    Here is help for the operating system:
    If you are locked to iOS 3 then you have an iPod Touch 1st Gen.
    If you are locked to iOS 4 then you have an iPod Touch 2nd Gen.
    If you are locked to iOS 5 then you have an iPod Touch 3rd Gen.
    If you are locked to iOS 6 then you have an iPod Touch 4th Gen.
    If you can get iOS 7 and have an iPhone 5 sized screen [bigger] you have the current iPod Touch 5th Gen.
    I assume since it says you have iOS 5.1.1 you have an iPod Touch 3rd Gen.
    Also, you may want to sync it so iTunes can tell you or you can look at the model number on the back.
    Hope this helped.

  • How can you found out what computers you are home sharing so you can delete some, How can you found out what computers you are home sharing so you can delete some

    How can you find out what computers you are sharing with so you can delete some

    Oh, have you brought up so many good points. Not to take us off-topic, but I could rant all day about Eloqua consulting firms who let low-level employees (Eloqua skill-wise) loose on clients projects. Just not fair for either the employee or client. There was one company that did this to me a few years ago, and since then dozens of people have asked me about them for a reference.  Needless to say, they never get a good one from me, and have likely lost hundreds of thousands of dollars in projects because of this. Not worth it in the long-run to cut corners.
    Back to the topic at hand....
    You really hit the nail on the head in so many ways. It really all does come down to one thing: hard work. There are no shortcuts. Always keep learning. Embrace every Eloqua challenge you can, and never say never.  Never be fearful of being wrong by asking something 'silly', or 'looking stupid'. I remember several times that I've submitted Eloqua support tickets, or tickets to other related vendors about things that I was convinced were bugs/major issues. Turned out to be my mistake. But that's ok. You brush off, stand back up, and learn from them.
    And finally, be modest.  You will never know everything about Eloqua. Be willing to learn from others, and know that there actually may be a better way to do something than you may have spent days or weeks working on.

  • "CAHeadless error Sequence.cpp-2233" after computer starts up.  Can you tell me what this is or how to fix it?  Thanks!

    Since installing Adobe Premier Elemnts 12 I get a message that says "CAHeadless error Sequence.cpp-2233" after computer starts up.  Can you tell me what this is or how to fix it?  Thanks!

    If you are using Firefox 3.6.6 version, open Tools > Options >> Advanced - Network
    The under Connections hit the Settings button - then select '''No proxy''' at the top of those settings. Restart Firefox and you should be all set.
    ''(3.6.6 added a new setting there - Use system proxy settings and sets that as the Default setting)''

  • Today I imported quite a lot of Audio CDs. When I wanted to listen to them I realised that most of them aren't in my library. And they did not appear in the recently added list either. Can anyone tell me what happened and where to find them? Thanks!

    Today I imported quite a lot of Audio CDs. When I wanted to listen to them I realised that most of them aren't in my library. And they did not appear in the recently added list either. Can anyone tell me what happened and where to find them? It's really strange because all the imorts definitely finished. Thanks!

    Greetings,
    I've never seen this issue, and I handle many iPads, of all versions. WiFi issues are generally local to the WiFi router - they are not all of the same quality, range, immunity to interference, etc. You have distance, building construction, and the biggie - interference.
    At home, I use Apple routers, and have no issues with any of my WiFi enabled devices, computers, mobile devices, etc - even the lowly PeeCees. I have locations where I have Juniper Networks, as well as Aruba, and a few Netgears - all of them work as they should.
    The cheaper routers, Linksys, D-Link, Seimens home units, and many other no name devices have caused issues of various kinds, and even connectivity.
    I have no idea what Starbucks uses, but I always have a good connection, and I go there nearly every morning and get some work done, as well as play.
    You could try changing channels, 2.4 to 5 Gigs, changing locations of the router. I have had to do all of these at one time or another over the many years that I have been a Network Engineer.
    Good Luck - Cheers,
    M.

  • My icloud don't recovery password can you help me  ? or can you say me alternative mail. and  reset my pasword ?, my icloud don't recovery password can you help me  ? or can you say me alternative mail. and  reset my pasword ?

    My forgot i cloud password can you say me alternative email for reset my password. or what is your advice for this problem  ? i reset my icloud but not deliver reset link
    <E-mails Edited by Host>

    Hi Ibrahim,
    Thanks for visiting Apple Support Communities.
    This article can help with resetting your password and security questions:
    Rescue email address and how to reset Apple ID security questions
    http://support.apple.com/kb/HT5312
    However, if you're not able to receive email to your rescue email address, you may need to contact iTunes Store Support:
    You'll need to contact iTunes Store support to have your questions and answers reset.
    After your password, security questions and answers are reset, I'd recommend providing a different rescue email address:
    You can edit or delete your rescue email address at My Apple ID. To edit your rescue email address:
    Navigate to My Apple ID using your web browser.
    Click "Manage your account"
    When prompted, sign in using your Apple ID and password.
    Click Password & Security
    You'll be asked to answer 2 of your 3 security questions before you can make any modifications. If you are unable to remember your answers, you can choose to send an email to your rescue email to reset your security questions.
    All the best,
    Jeremy

Maybe you are looking for

  • Can't install Itunes 8.1.1

    Everytime I load Itunes I get the "Itunes 8.1.1 is available for download" message and I attempt to download it, The file downloads and opens to install it get's to the 95% area and a error message pops up that the Itunes Installer has incountered an

  • Creating a simple photo gallery.. buttons not working.

    Im trying to create a photo gallery that when you click on the thumbnail image you get a blown up image on the screen. The user will then hit the little "x" button to return to the thumbnail page. I have attached pictures of what they look like. My i

  • Ear buds not working. Not due to broken headphones, so it must be the connector in the iPod that is not working.

    On my iPod Classic, the right ear bud does not work and the left one spots off and on. The music works fine on a dock, and I know it is not due to broken headphones (a problem I've encountered many times), because they work fine on other iPods, other

  • How to copy a PLD in one database to another.

    Hi, How can we copy a PLD in one database to the other without using Copy Express. I tried openin up the PLD in the Test DB and copying it over to the Live DB, using Edit copy and Paste, but it doesn't work.... Is there any other way it can be done?

  • Pages loose item persistence in frames

    I have these pages that branch to each other. This works fine, except when the HTMLDB pages are part of an intranet app and actually rendered inside a frame. When this happens, then my page cache is cleared even though I do not explicitly clear it wi