I know that we shouldn't compare Strings with == and its better to use equals. For so far I learned this should all be false. So why does the first method return true?    private String ab = "AB"; private String ab2 = "A" + "B"; private String a = "A"; private String b = "B"; private String ab3 = a + b;  public void test () {     System.out.println("ab == ab2" + ab==ab2);     System.out.println("ab == ab3" + ab==ab3);     System.out.println("ab == a+b" + ab==(a+b)); }
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?
I'm going through MSIL and noticing there are a lot of  instructions in the MSIL.  The MSDN article says they take no action and are used to fill space if the opcode is patched. They're used a lot more in debug builds than release builds.  I know that these kinds of statements are used in assembly languages to align later instructions, but why are MSIL nops needed in MSIL?  (Editor's note: the accepted answer is about machine-code NOPs, not MSIL/CIL NOPs which the question originally asked about.) How to use PostgreSQL/PostGIS with ArcGIS for Desktop? How to change account profile picture? I can't believe I have to ask this...but, how do I change my account profile picture in Ubuntu 12.04 Desktop? One would think it would be under the "User Accounts" section. Is it possible to export a single object from an entire scene? Hiding some slides in student handouts in Beamer I am preparing lecture slides for a class. I would like to hide some of the slides from the students. As an example, I would like to be able to compile students.pdf which has only student slides 1 and 2 (i.e., "teacher slide" is hidden); but teacher.pdf which has all three slides.  \documentclass{beamer}  \begin{document}  \begin{frame}{Student slide 1} blah blah blah \end{frame}  \begin{frame}{Teacher slide} secret stuff not to be shared with students \end{frame}  \begin{frame}{Student slide 2} blah blah blah \end{frame}  \end{document}   How would I do this in beamer? In a regular document, e.g., article, I would use the comment environment.  I feel that the approach in  is overkill for my needs. Has the wall been repaired? Solve for $f(x)$ if $f(f(x))=6x-f(x)$ In ArcGIS there is a Erase Point tool how can this be done in R How do I set the proper exposure for nighttime moon photos? All my attempts to get a good shot of the full moon with my DSLR result in an overexposed circle on a black background.  I've tried using a tripod, remote shutter release, low ISO, and long exposure, but nothing has worked so far.  What combination of ISO and exposure time that will produce good results?   I particularly want to catch a full moon with the reddish effect when it is close to the horizon. Create an instance of a class from a string Is there a way to create an instance of a class based on the fact I know the name of the class at runtime. Basically I would have the name of the class in a string. Evaluate  $$\int_0^\infty \frac{\log x \; dx}{x^{2} + 2x + 2}$$  by integrating a branch of $(\log z)^{2}/(z^{2} + 2z +2)$ along a keyhole contour.  The thing I have trouble with is why I should be examining the square of the log - I guess it has something to do with ln x in fact NOT being the real part of log z, since log z is (or can be) defined on the entire negative real axis and ln x can't. But looking at the square would definitely not have been my first plan of attack :( Elevating process privilege programmatically? I don't understand philosophy very well, and so I am wondering whether you can "prove" anything in philosophy. It always seems you can go a layer down, and find another question, almost endlessly until you get to the question of "why/how/are we here?"  Can you prove, absolutely, and 100% that something is true, in the field of philosophy? How to decompose a unitary transform into two-level unitary matrices? Can Dementors die? Based upon , J.K. Rowlings has apparently stated "You cannot destroy Dementors, though you can limit their numbers if you eradicate the conditions in which they multiply, ie, despair and degradation."  Does this mean that the number of Dementors is always either increasing or remaining the same?  If they cannot be destroyed, does that mean they are immortal?  Or do they die of "natural causes"? How to edit geometry of multiple layers simultaneously in QGIS 3? I have several line layers (route, pipes, cables) that share the same geometry and would like to edit them simultaneously.   Is there a way to easily snap the geometry of the pipes and cables layers to the route layer so that I can simply change the geometry of the route layer and don't have to repeat all changes on the other two layers as well?  To clarify, I plan a fibreglass route and have three layers. The first one describes the route that I have to take to pass all homes that have to be connected. The second one contains the pipes in which the cables lie and the third layer is the cable layer. So all features on those layers have to have the same geometry. Once I change the pathway of the route layer, I have to apply the same changes to the other two layers to ensure that they are still aligned with the route layer. I'm not sure whether I understand your comments correctly, but I use the basic editing tools in QGIS 3. How exactly does time slow down near a black hole? How exactly does time slow down near a black hole? I have heard this as a possible way of time traveling, and I do understand that it is due in some way to the massive gravity around a black hole, but how exactly does that massive gravity slow down time? Which one is correct: "Do you wake at seven?" or "Do you wake up at seven?" Someone said to me that the first one is the correct answer, because you use "wake up" to ask someone to stop sleeping. But I think the first one does not sound natural. Abelianization of free group is the free abelian group Ubuntu 16.04 multitouch gestures