I want to give user a possibility to stop inputing new lines in my String array by entering the word "end". I checked out - it really inputs 'end' before the if statement, but for some reason this doesn't break the while cycle:  Scanner scan = new Scanner(System.in);            String[] str = new String[50];                     int j=0; int f = 0;                            System.out.println("Input 'end' to see your previous input!"); while(f != -1) {   the input goes well, but the if statement doesn't work completely   String choice = scan.nextLine();                 if(choice == "end")                             {                  f = -1;                            }              else              {                  str[j] = choice;                  j++;              }        }
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?
Post hoc test after ANOVA with repeated measures using R Strange error defining a macro with arguments for math mode Changing Custom Post Type Name Order Recently I answered two questions on SO: The  is a completely trivial answer to a really basic question (kind of "read the manual and follow the one liner example there"). On the other hand, my  is a much more complicated answer that requires much more specialized knowledge of a very specific domain (happens to be related to my PhD research).  Clearly, the first answer could have been given by many SO users - I just happened to be the first to pick up the glove on this question. However, this is not the case for the second answer.  In contrast, when it comes to reputation - the first answer instantly got upvoted (everyone can relate to a simple question/answer), while the second one - I don't believe it will get much upvotes...  So, life isn't fair: for the one answer that really very few people could provide (the second answer) and is much harder to find and get -- is not rewarded, while the trivial answer is rewarded fast and strong...  How can we amend this? How can we encourage rare and specialized answers for difficult and deep questions?  Do we want SO to turn into a pool of trivial and superficial questions?    Update: Thanks to many meta-users who took the time to read through this question and ponder its implication, both answers I used as examples got exposed far beyond their fair-share. So, despite the fact that my original claim that the specialized answer get less reps is no longer valid, this does not change fact that in general my claim is stil valid: specialized answers requiring expert knowledge will recieve less attention at first.    Bottom line: (following my wish to have some sort of ). Indeed it sometimes seems like life isn't fair, but this is only in the short term. In the long run high quality answers do get their proper credit and exposure and their fair share of reputation. The reputation system of SO works quite well balancing and accounting for many factors and parameters. It would require a really strong argument backed up with serious research to change this mechanism.   Thank you all for the lively discussion and for showing me that life is fair after all. I've noticed that the majority of Ubuntu help websites present apt commands in the following format:  sudo add-apt-repository ppa:[ppa-address] sudo apt-get update sudo apt-get install [application-name]   But I know that apt commands like this one work too:  sudo add-apt-repository ppa:[ppa-address] &amp;&amp; sudo apt-get update &amp;&amp; sudo apt-get install [application-name]   Is there a particular reason that most sites present in the first format? Are there known issues with chaining commands with &amp;&amp;, or to put it another way are there any benefits/drawbacks to using either method?  Further, other then loss of internet, are there any circumstances in which an apt command might fail? Suppose that sequences of real numbers satisfy:  \begin{align*}   a_n &amp;= \sum\limits_{r=0}^n \binom{n}{r} b_r \\ \end{align*}  Prove that:  \begin{align*}   (-1)^n b_n &amp;= \sum\limits_{s=0}^n \binom{n}{s} (-1)^s a_s \\ \end{align*}  My work:  The $n=0$ case:  \begin{align*}   a_0 &amp;= b_0 \\   b_0 &amp;= a_0 \\ \end{align*}  Then $n=1$ case:  \begin{align*}   a_1 &amp;= \binom{1}{0} b_0 + \binom{1}{1} b_1 = b_0 + b_1 \\   -b_1 &amp;= \binom{1}{0} a_0 - \binom{1}{1} a_1 = a_0 - a_1 \\   b_1 &amp;= a_1 - a_0 = b_0 + b_1 - a_0 = b_1 \\ \end{align*}  The inductive step:  \begin{align*}   (-1)^{n+1} b_{n+1} &amp;= \sum\limits_{s=0}^{n+1} \binom{n+1}{s} (-1)^s a_s \\ \end{align*}  I'm not sure where to go from here. I tried substituting $a_s$ into that last equation and it didn't help. Any ideas? in QGis 1.8 were lots of predefined coordinate systems (national projections). Where have they all gone in qgis 2.0? I specifically need the Gauß-Krüger-Projections Zone 1 to 5.  Is there any plugin to load those coordinate systems? Why is it that Blender will only allow me to render with a CPU (GPU choice is unavailable)? Or is it until I acquire a graphics card that is specially built for such a task?  The images below show a Dell System Diagnostics (Video calibration) and GPU-Z results.      Platform: Dell Inspiron 3521 notebook with Core&nbsp;i3 Intel HD Graphics 4000 Ubuntu 13.04 on Mac Mini 6,2 ethernet port Broadcom NetXtreme BCM57766 not detected The said network adapter is not recognized in 13.04. In 12.04 and 12.10 I had used the driver proposed from broadcom download site, configured as dkms package it was always updated.  On the 3.8.x kernels this provided kernel driver from broadcom does not compile anymore - and the distribution provided tg3 drivers does not recognize the ethernet adapter - even though it is a newer version.  ~$ modinfo /lib/modules/3.8.0-19 generic/kernel/drivers/net/ethernet/broadcom/tg3.ko | grep -i version version:        3.128 srcversion:     D737202366709FE01964BF0 vermagic:       3.8.0-19-generic SMP mod_unload modversions    Here the working version on kernel 3.5.x using dkms  ~$ modinfo /lib/modules/3.5.0-25-generic/updates/dkms/tg3.ko | grep version version:        3.124c srcversion:     D01ED9A7BF2C3956E212A63 vermagic:       3.5.0-25-generic SMP mod_unload modversions    The Network card:  ~$ lspci -nn | grep 0200 01:00.0 Ethernet controller [0200]: Broadcom Corporation NetXtreme BCM57766 Gigabit Ethernet PCIe [14e4:1686] (rev 01)   As found on the i7 Mac Mini 6,2.  Anyone knows where I can get a kernel that recognizes that ethernet device ? That chip is supported somehow ... And - the 3.8.x kernel is way better on the HD4000 chip - reason I use it.  Note - to get the WiFi working, just make sure you load the b43 driver at boot (/etc/modules). At least then you have Network connectivity. Get referenced node fields in twig In Drupal 8, I have a content type, that has an "entity_reference" field and I wish to access the referenced node's fields in twig template. the kint() output for the field is:   In this list I can't find the referenced node's field values. How can I (if at all possible) load the node or node fields/values in twig?  Best,  Alari Cannot select text in Safari address bar Electric fields and potential E = electric field V = electrostatic potential r = distance ' = derivative   E = - (V)'   therefore if E increases V decreases Also if r increases E decreases                                                      because  E=kq/r^2 From 1 &amp; 2, if r increases then V increases But V=kq/r, so if r increases V decreases   Why does the 3rd point contradict with the 4th ? How to scroll in a terminal using keyboard? How can I scroll in bash using only the keyboard? If it's not possible in bash, are there any other shells that support this? Is it true that $aH = bH$ iff $ab^{-1} \in H$ Let $H$ be a subgroup of a group $G$. The I know that for $a,b\in G$ we have $aH = bH$ if and only if $a^{-1}b \in H$.  My question is if it is also true that $aH = bH$ if and only if $ab^{-1} \in H$? Does it matter where the $-1$ goes?  I am guessing that this is not true since we keep putting the $-1$ on the left element, but I am also thinking that it might be true because they look like the same.  If $G$ is abelian, then it doesn't matter, so a possible counter example would have to involve a non-abelian group. If $H$ is a normal subgroup, then it should also be true because then $a^{-1}bH = Ha^{-1}b$. I have an independent variable called "quality"; this variable has 3 modalities of response (bad quality; medium quality; high quality). I want to introduce this independent variable into my multiple linear regression. When I have a binary independent variable (dummy variable, I can code 0 / 1) it is easy to introduce it into a multiple linear regression model.  But with 3 modalities of response, I have tried to code this variable like this :  Bad quality      Medium quality      High quality       0                1                  0      1                0                  0      0                0                  1      0                1                  0   But there is a problem when I try to do my multiple linear regression: the modality Medium quality gives me NA:    Coefficients: (1 not defined because of singularities)    How can I code this variable "quality" with 3 modalities? Do I have to create a variable as a factor (factor in R) but then can I introduce this factor in a multiple linear regression? I have Windows 8 (final, MSDN) on my Macbook Pro Retina.  Windows 8's ongoing, continuous tantrum of insisting that it's on a tablet device is causing it to always have a touch keyboard 'icon' on  the taskbar.  The 'icon' is actually a toolbar and I can temporarily disable it by right clicking the taskbar and DE-selecting it. However, upon rebooting the system, it always insists on coming back and activating itself.    How can I permanently disable the touch keyboard toolbar in the taskbar? Why must I wait two days before accepting my own answer? I got this message today while trying to accept my answer on my own question.  Why must I wait this time, if I am sure that the answer I answered is the right one, just want to understand the point of view?  I faced that just today on Super user and didn't get this message before. Prove that : $a_n>0$, Then, $\sum_{n=1}^\infty a_n$ converges iff $\sum_{n=1}^\infty \sin(a_n)$ converges. I am given the problem: Let $a_n&gt;0$, prove $\sum_{n=1}^\infty a_n$ converges if and only if $\sum_{n=1}^\infty \sin(a_n)$ converges.  We have this problem in a homework, and I don't believe it can be true. The statement being biconditional implies that when $\sum_{n=1}^{\infty} \sin(a_n)$ converges, so too does $\sum_{n=1}^\infty a_n$, but if we take $a_n=\pi n$ or even $a_n=\pi$, then $\sum_{n=1}^\infty \sin(a_n)$ converges while $\sum_{n=1}^\infty a_n$ diverges. Is my thinking incorrect? How do you prove the second law of thermodynamics from statistical mechanics? Performance of a Trigger vs Stored Procedure in MySQL