why str1==str2 is returning false while str2 == str3 returns true in below code? As per my understanding, str1==str2 should also return true.  public static void main(String[] args) throws Exception {         String str = "me";         String str1 = str + "test";         String str2 = "metest";         String str3 = "me" + "test";         System.out.println(str1==str2); // O/P false         System.out.println(str2==str3); // O/P true      }
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?
Difference between "I have got" and "I have gotten" I see these two expressions are used almost identically in different contexts. Is there a difference between I have got and I have gotten? If $a$ divides $bc$ and $\gcd(a,b) = d$ then $\frac a d$ divides c I'm trying to prove that if $a$ divides $bc$ and $\gcd(a,b) = d$ then $\frac a d$ divides c. I tried using Bezout identity but couldn't get anywhere. While finding escape velocity, does human mass counts as the mass of Earth? Escape velocity depends upon the mass of earth. my doubt is whether human mass adds into it or not? If it add then Earth's escape velocity would be increasing! Select translation: where? Mandatory excerpt for custom post type How do I write a correct micro-benchmark in Java? How do you write (and run) a correct micro-benchmark in Java?  I'm looking for some code samples and comments illustrating various things to think about.  Example: Should the benchmark measure time/iteration or iterations/time, and why?  Related: Proving that an integral domain has at most two elements that satisfy the equation $x^2 = 1$. I'm just getting started with Pinter's A Book of Abstract Algebra, please be kind. The book solution for Chapter 2, Problem 7 claims that the following operator is non-associative:  $$ x * y = \frac{xy}{x+y+1}$$  The book solution:  $$ (x * y) * z = \left(\frac{xy}{x+y+1}\right) * z = \frac{xyz(x+y+1)}{x+y+z+xy+yz+xz+1}$$  $$ x * (y * z) = x * \left(\frac{yz}{y+z+1}\right) = \frac{xyz(y+z+1)}{x+y+z+xy+yz+xz+1}$$  However the $(x+y+1)$ and $(y+z+1)$ terms appear to actually cancel out:  $$ (x * y) * z = \left(\frac{xy}{x+y+1}\right) * z = \frac{\left(\frac{xy}{x+y+1}\right)z}{\frac{xy}{x+y+1} + z + 1} $$  $$ x * (y * z) = x * \left(\frac{yz}{y+z+1}\right)  =\frac{x\left(\frac{yz}{y+z+1}\right)}{x+\frac{yz}{y+z+1} + 1} $$  So the denominators cancel out, the two groupings are equivalent, the operator is associative.  This result is duplicated in Mathematica, but I'd like to make sure I'm not missing something.  Sorry for bothering people with such a basic question. How do you use a gray card? There are already   on how to make a gray card, but unfortunately my ignorance goes deeper than that.  How do you use a gray card? I've got a directory shared on my network, using Samba. People on the netwerk use this Samba share to download files from my share to their computers. I'm interested in what files are downloaded most, and by which users they are downloaded. I'd like to see this in real time, if possible. Is there a program that allows me to do this? If yes, how can I use it?    I'm using Ubuntu 11.10. I constantly have problems working with dates in Excel, I must be doing something wrong but I don't understand what.  I have a spreadsheet, exported from our exchange server, that contains a column with dates on. They have come out in US format even though I'm in the UK.   The column in question looks like this  04/08/2012 04/09/2009 04/01/2010 04/21/2011 04/05/2012 08/30/2009 08/29/2010 08/28/2011   In Excel, I have highlighted the column and selected Format Cells.... In this dialog box, I have selected the Date, selected English (United States) as the locale and chosen the matching date format from the list. I hit OK and try to sort the data by this column.   In the sort dialogue I choose this column, select sort on Values but the order only gives me options for A to Z, not oldest to newest as I would expect.  This in turn sorts the date data by the first two digits.  I am aware I could re-format this data to ISO and then the A to Z sort would work but I shouldn't have too, I'm obviously missing something. What is it?  EDIT: I messed up the bounty but this should have gone to @r0berts answer, his first suggestion of Text to Columns with no delimiter and choosing 'MDY' as the type of data works. Additionally, if you have a time (i.e. 04/21/2015 18:34:22), you need to first get rid of the time data. However after that the method suggested by @r0berts works fine. How is the popularity of "recent tags" calculated? How are these calculated? I see them going up and down all the time, and there are obviously way more than 48 questions about C# so how are these calculated? Preposition confusion - Do you learn somthing 'at' school OR 'in' school? I know that we use the preposition at to describe a place. I learned French at school is one of the examples I can think of.   I came across two examples that use the preposition 'in' with 'schools' in the context of 'learning'.   Example #1 from the  website:      Eleven things that you will never learn in school.   Example #2 from      Do you think the skills you learn in school will help you get the job you want?   The use that I had in my mind is here on      Should Parents Control What Kids Learn at School? Well structured URLs vs. URLs optimized for SEO Packaging a bike for flying with a bike bag Center of mass in a straight rod I got an assignment to prove that in a straight homogeneous rod, you can always choose a coordinate system in such a way that  $$\int_S x_1 \, dx_1 \, dx_2=0 $$  $$\int_S x_2 \, dx_1 \, dx_2=0 $$  $$\int_S x_1x_2 \, dx_1 \, dx_2=0$$  where $S$ is the cross section of the rod  Now, intuitively, I can understand that the first two expressions basically state that if you find the mass center of the rod, then all you have to do is to put the origin of the coordinate system in the mass center, and the integrals turn out to be zero. What I'm curious about is whether or not this is a good enough of an explanation, and also, a hint on how to obtain the third equality. Why are the dineutron and diproton unbound? Every planar graph has a vertex of degree at most 5. How can I highlight text before a character with listing? How to contact professors for PhD vacancies? I know many master's students who get an opportunity to talk to their potential PhD advisors well before applying. In most cases this opportunity is available by the professors with whom they worked for their master's. Moreover, there are many others who establish a contact with professors by mailing them and enquiring about PhD vacancies.   My questions are:   How important is knowing an advisor prior to applying for PhD?  Does an email interaction play a vital role when the department makes its admit decisions? If email contact is important, can a student send out mails to 2-3 professors (working in the same area) in case one of them does not bother to reply? To sum up, is applying of any use (especially in top universities) when you have no contacts and only your credentials to bank on?