I know that java stores String Literals in Common Pool and two string literals having the same text will refer to the same place in Common Pool. take below code:  String str1 = "Amir"; String str2 = "Amir";   now both str1 and str2refer to the same place in the Common Pool. so from what all we know we must use equals() to properly compare these two strings and obviously str1.equals(str2) will be true.   now from what i read   it says that the str1 == str2 will be true becuase the strings both have the same address (sounds pretty logical) but it also states that its a logical error to do so.  my question is what is that special case that may cuase trouble and inconsistency to my code if I use str1 == str2 ?
I've been using the == operator in my program to compare all my strings so far. However, I ran into a bug, changed one of them into .equals() instead, and it fixed the bug.  Is == bad? When should it and should it not be used? What's the difference?
Russian babel and chemformula Uncertainty principle and multiple observers Google Drive storage mismatch Can FFMPEG extract images from a video with timestamps? Can a free particle absorb/emit photons? How we can compare two coefficients of one linear regression? This is a  about Fighting Spam.   Also related:                    There are so many techniques and so much to know about fighting SPAM. What widely used techniques and technologies are available to Administrator, Domain Owners, and End Users to help keep the junk out of our inboxes?  We're looking for an answer that covers different tech from various angles. The accepted answer should include a variety of technologies (eg SPF/SenderID, DomainKeys/DKIM, Graylisting, DNS RBLs, Reputation Services, Filtering Software [SpamAssassin, etc]); best practices (eg mail on Port 25 should never be allowed to relay, Port 587 should be used; etc), terminology (eg, Open Relay, Backscatter, MSA/MTA/MUA, Spam/Ham), and possibly other techniques. Allowing only one download per Apple ID Are drops in Google ranking common after switching to https? About a week ago I made the switch to https on one of my sites. I'm positive I did everything right. Properly setup 301 redirects from http to https versions. Added and verified https version in Webmaster Tools. Updated all internal links. Submitted new sitemap.  Despite that, many of my pages (about 40%) lost their rankings almost immediately. Those that dropped went from page 1 to nowhere. I can still see them indexed if I search for the URL, but otherwise it's like Google doesn't know they exist.  SSL Labs shows an "A" when I run their test and I have no manual actions showing in Webmaster Tools.  This is really frustrating. I don't actually need SSL, but Google finally scared me into it. Now I'm regretting the switch and contemplating going back to non-secured URLs.  Anything else I could have missed? QGIS creating a fixed distance buffer over selected areas not the entire layer what im doing is making a fixed distance buffer and it's working splendidly but i need the buffer to be created over certain selected areas not the entire layer, and at the creation wizard is only offers the the option of selecting the entire layer, and i need some areas within that layer to have a different buffer and some none at all.  is there a way around that? "There is no point in" or "There is not a point in" I was thinking about these negations. Do these mean the same thing?     There is no point in ...   There is not a point in ...   or:     I have no clue   I do not have any clue     etc. Energy momentum tensor from Noether's theorem in the book Quantum Field Theory by Itzykson and Zuber the following derivation for the stress-energy tensor is proposed (p.22):  Assume a Lagrangian density depending on the spacetime coordinates $x$ only through fields and their gradients. Under a translation we have $$\mathcal L (x+a)=\mathcal L[\phi_i(x+a),\partial_\mu\phi_i(x+a)].$$  Consider an infinitesimal $x$-dependent transformation $$\delta\phi_i=\delta a^\mu(x)\partial_\mu\phi_i(x),$$ $$\delta\partial_u\phi_i(x)=\delta a^\nu \partial_\nu\partial_\mu\phi_i(x)+\partial_\mu[\delta a^\nu (x)]\partial_\nu \phi_i(x).$$  The proof then proceeds with variation of the action and integration by parts. But why do we consider an $x$-dependent local transformation instead of a global transformation? Prove the following: If $a \mid bc$, then $a \mid \gcd(a, b)c$. Prove the following: If $a \mid bc$, then $a  \mid \gcd(a, b)c$.   I tried to set $\gcd(a, b)$ to $b$ and used the fundamental theorem of arithmetic to prove that it is divisible by $a$, but I can't prove that $a \mid bc$, if and only if $a\mid b$ and $a\mid c$. Please help. Thanks. How to effectively deal with Imposter Syndrome and feelings of inadequacy: "I've somehow convinced everyone that I'm actually good at this" How do I install and manage RPMs? We have given isosceles triangle $ABC$ with baseline $AB$. Point $M$ is midpoint of AB. Draw perpendicular line to side $AC$ through $M$ which intersects $AC$ in point $H$. Let $P$ be midpoint of $MH$. Show that lines $BH$ and $CP$ are perpendicular to each other.  I also have "hint": Construct height $BD$ to side $AC$ and look at the triangles $ABD$ and $MCH$.  Analytically there is no problem but I get stuck in geometrical approach to solution. I have a map a at the link below:    I added one of my GeoServer WMS layers to the map, now I try to add the attributes window pop up on click. I found to examples on the OpenLayers 3 homepage, but I cannot put together a working code...      Is there any chance to have a working sample somewhere? Steam doesn't start after upgrade to Ubuntu 16.04 After upgrade to Ubuntu 16.04, Steam doesn't start. When I execute it from the command line, I get the following error:  $ steam Running Steam on ubuntu 16.04 64-bit STEAM_RUNTIME is enabled automatically grep: symbol lookup error: grep: undefined symbol: pcre_jit_stack_alloc grep: symbol lookup error: grep: undefined symbol: pcre_jit_stack_alloc grep: symbol lookup error: grep: undefined symbol: pcre_jit_stack_alloc Installing breakpad exception handler for appid(steam)/version(1459463254) When I tried to run , I got the below screen:    The captcha is missing!  I tried in other browsers too.    Update:  From @Oded's comments, I changed to HTTP and it was working perfectly.  Out of curiosity I would like to know why the captcha isn't working when accessing Data Explorer over HTTPS. Why doesn't the Java SDK installer set JAVA_HOME? I always wondered why I have to manually set the JAVA_HOME environment variable after installing the Java SDK.     JAVA_HOME=c:\Program Files\Java\jdk1.6.0_12   Visual Studio at least provides a batch file to set these kind of environment variables:     call "c:\Program Files\Microsoft Visual   Studio 9.0\VC\vcvarsall.bat"   Does Java have something similar? I'm trying to make a build script that should simply work after installing the Java SDK. I don't want people to mess with environment variables on their PC.