This is a program that runs a Conways Game of Life simulation. The main method is here:  public static void main(String Args[]) {     int x = 0;     int y = 0;     boolean cellState[][] = new boolean[][]{};     boolean newCellState[][] = new boolean[][]{};     String answer;     Scanner input = new Scanner(System.in);      while (true) {         System.out.print("\n Type anything for next generation, 'new' for new grid, or 'stop' to end&gt;&gt; ");         answer = input.nextLine();         if (answer == "new") {             cellState = newCells(cellState);         } else if (answer == "stop") {             break;         } else {             System.out.println("Not an option yet");         }     } }   No matter what answer is entered it will skip past the if statements and return to the beginning of the loop.   It has nothing to do with the actual contents of the statements as far as I can tell, but its might have to do with the boolean expressions.
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?
How can I get a shapefile from a postgis query? Why do rainbows have distinct colors? When I searched on the Internet for the reason of formation of , I got many explanations like  one &amp; . All the explanations consider only one spherical water droplet (like ).  Why don't the refracted waves coming from the adjacent droplets interfere with each other? For example, why doesn't a red ray coincide with a violet ray coming from another droplet at a suitable position?   How are we able to see rainbows with distinct colors? Since there are thousands of raindrops in the sky when it is raining, shouldn't it be a mess due to overlapping of different wavelengths?  Please explain. Solving an Op-amp circuit The image of the circuit is shown below and it required to find \$V_0\$,  My first attempt at solving this problem is by changing the current source into a voltage source with 1-V and 2k\$\Omega\$ resistance. The fact that the inverting and non-inverting terminals aren't grounded make this problem look difficult.To the point which, I don't know how to proceed with this question or where to start. I would appreciate any help. Following some thought and another schematic from a hint suggested by Alfred, I produced a schematic representing our work.  And  my solution for the problem is below, Using node equation at nodes A and B we have, $$\frac{V_A-V_B}{1k}=-0.5 \text{mA}$$ $$\frac{V_B-(2+V_A)}{1k}=-0.5-x$$ where x is the current that is sent in the output of the op-amp. Using KCL, at the bottom node near the current source we see that the same current that goes through the op-amp also goes through the \$2\text{k}\Omega\$ resistor. Hence, we have, $$\frac{-V_A}{2k}=x$$ Replacing this in the second equation, $$\frac{V_B-(2+V_A)}{1k}=-0.5+\frac{V_A}{2k}$$ And and solving the equations yields \$V_A=-2 \text{-V}\$ and \$V_B=-1.5 \text{-V}\$ Vote can't be changed if answer is edited too quickly Every cyclic group with order > 2 has at least 2 distinct generators Every cyclic group with order > 2 has at least 2 distinct generators   Here's what I've got so far:  Either order of our group, $G$, is finite or infinite.  Suppose infinite: then our group is isomorphic to $\mathbb Z$ under addition. This group has two distinct generators, therefore so does $G$.  Suppose finite: Then $G$ is isomorphic to $\mathbb Z_n$ under addition modulo $n$.  We know order of $G$ is $\geqslant 3$. If order of $G$ is odd, both 1 and 2 are generators of $\mathbb Z_n$ under addition modulo $n$, so $G$ has at least two generators.  If order of $G$ is even, then both 1 and some odd number between 1 and $n$ are generators. How do we determine this odd number?  Does this look like I'm on the right track? What does "user was removed" mean and why did my reputation change because of it? Message appearing when a user was removed.     It seems I lost 1765 reputation points on Stack Overflow yesterday. The reason given in my history is "removed", with the description of "User was removed ()". I don't understand what that means. What caused this? Why is this CW post saying 36% unknown? Looking at         it says "36% unknown". No user by the name of 'unknown' appears in the  ()  What madness is this? Who is this 'unknown' you speak of? I'm trying to find an alternative to the standard tombstone qed symbol for more informal papers. I initially thought of an empty square with Pub written inside, but what would actually be better would be a small beer mug symbol. (much like the one found in this set of icons )  Unfortunately there doesn't seem to such a symbol in the comprehensive latex symbol list (although many funny symbols can be found there). Has anyone thought about this? Is there any quick-and-dirty solution? If $A$ and $B$ are square matrices such that $AB = I$, where $I$ is the identity matrix, show that $BA = I$.    I do not understand anything more than the following.   Elementary row operations. Linear dependence. Row reduced forms and their relations with the original matrix.   If the entries of the matrix are not from a mathematical structure which supports commutativity, what can we say about this problem?  P.S.: Please avoid using the transpose and/or inverse of a matrix. Can I recover app data after the phone has been Factory Reset? Title is removed/cleared/erased when starting editing Confusion between Voltage gain & Voltage gain in decibels (dB) The definition of voltage gain is \$V_{\text{out}}/V_{\text{in}}\$.  However, I read some articles about the gain in decibels, and I have a confusion now.  Here is an article about it:   Here, I understand the definition of Power gain in decibels, which is $$ \text{Gain} = 10 \log \left( {P_{\text{out}} \over P_{\text{in}}} \right)\text{ dB} $$  However, I can't understand why Voltage gain in decibels is $$ 20 \log \left( {V_{\text{out}} \over V_{\text{in}}} \right)\text{ dB} $$  If \$ 20 \log \left( {V_{\text{out}} \over V_{\text{in}}} \right)\text{ dB} \$ is derived from $$ 10 \log {\left( {V_{\text{out}}^2 \over R_{\text{out}}}\right) \over \left({V_{\text{in}}^2 \over R_{\text{in}}}\right) }\text{ dB} $$ then this is the power gain, not the voltage gain, isn't it? However, the Wikipedia says it is a formula for the Voltage gain in decibels. I thought the voltage gain in decibels would be \$ 10 \log \left( {V_{\text{out}} \over V_{\text{in}}} \right)\text{ dB} \$. Actually, the example section in that linked page uses voltage gain \$ V_{\text{out}} \over V_{\text{in}} \$.  Why did \$V^2/R\$ suddenly come out from the voltage gain in decibels? Prove by induction that $n^2<n!$ Sum of reciprocals of numbers with certain terms omitted I know that the harmonic series $1 + \frac12 + \frac13 + \frac14 + \cdots$ diverges. I also know that the sum of the inverse of prime numbers $\frac12 + \frac13 + \frac15 + \frac17 + \frac1{11} + \cdots$ diverges too, even if really slowly since it's $O(\log \log n)$.  But I think I read that if we consider the numbers whose decimal representation does not have a certain digit (say, 7) and sum the inverse of these numbers, the sum is finite (usually between 19 and 20, it depends from the missing digit). Does anybody know the result, and some way to prove that the sum is finite? Solution of limit $\lim\limits_{x\to 0} \frac {e^{-1/x^2}}{x} $ Small question, I'm trying to solve this limit but I just can't wrap my head around this problem.  $$\lim_{x\to 0} \frac {e^{-1/x^2}}{x} $$  L'Hopital just seems to make it messier.   It's probably pretty simple - I'd like to hear what I'm missing. Why so many files in /usr/share/app-install/desktop? For 14.04, I'm trying out Lubuntu LTS.  If I run ls -l /usr/share/app-install/desktop, I get a list of 3085 .desktop files. All except one are dated Apr 18. The exception is:  -rw-r--r-- 1 root root  6328 Mar 28  2013 applications.menu   From the dates, it's clear that all these are installed by default and not by me.   Doesn't each GUI-based program bring in its own .desktop file at the time it's installed (mostly in /usr/share/applications)? Then why are these thousands of other .desktop files needed? From their names, most of them haven't anything to do with Lubuntu. Their names are different from regular .desktop files (such as those in /usr/share/applications): many, not all, are like name:name.desktop whereas the regular ones are just name.desktop. The ones I looked at all have a line with X-AppInstall-Popcon=nnn where nnn is a string of digits. I know that Popcon "gathers statistics determining which packages are the most popular with Ubuntu users". But why is that part of these .desktop files? Similar matrices and minimal polynomial I am looking for an example such that in a pre-Hilbert space $H$ we have for a subspace $U$ that  (i) $\bar{U} \oplus U^\perp \neq H$  (ii) $ \bar{U} \neq U^{\perp \perp}$  Since finite and closed subspaces will probably not do it, I am not good at inventing nice examples. Does anybody here have a few at hand? Creating Digital Terrain Model from Digital Elevation Model using ArcGIS for Desktop? I have a DEM and I want to create a DTM from that DEM. Is it possible to do this in ArcGIS? How do I recover lost/inaccessible data from my storage device? What steps can I take to try to recover lost or inaccessible data from any storage device?  Answers:   This applies to any computer storage device, e.g. internal/external hard drives, USB sticks, flash memory. The most important thing is to STOP using it, any type of I/O can ruin your chances of a recovery.     We have separate questions covering common problems with USB flash drives in greater detail: