I am coding a little election Program for the upcoming Election's in Germany. Well, it is not working.   public static void main(String[] args) {     String _Kandidat1;     String _Kandidat2;      _Kandidat1 = JOptionPane.showInputDialog("Do you Vote for the AFD or for the CDU ?");     if (_Kandidat1 == "AFD")         System.out.println("The AFD won the election!");     else         System.out.println("The CDU won the election!");     } }   If I type in "AFD" it says the CDU won. If I type in "CDU" in nothing happens. I'm not sure, but I think the mistake is in if (_Kandidat1 == "AFD")   Any solutions?
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?
es.SO questions aren't excluded from the Hot Questions list As figured out in  localized SE sites must not be displayed in the HNQ's. But  actually is.        Has to be fixed I guess? The only things I've found so far are a cart method (which ceased working in 1.6), a dispenser method (utilizing the decay on dropped items, but this requires occasional feeding), and a binary counter (which won't work for a single input but rather a fluctuating one).  I want to have a circuit that when I apply an input signal, the output signal doesn't change for 2 to 5 minutes.  When the input turns off, I again want a 2 to 5 minute delay.  I could accomplish this with (roughly) 240 to 600 redstone repeaters, but this is far in excess of being useful.  The only method I can think of, but would require a XOR gate (on the button-input and final output) to start and stop a clock attached to a binary counter.  While I can make room for a device of this size, I was hoping for something simpler. Okay. If I wanted to redirect the output of a program to a file, I'd do something like this  prog &gt; file   If I wanted to redirect both stdout and stderr to that file, then I'd do  prog &gt; file 2&gt;&amp;1   This is all well and good if you want the output to go to the file. But what if you want the output to go to the file and yet still go to stdout/stderr? So, the output is saved in the file, but you can still see it on the console as the program is running. Is there a way to do that? And if so, how? Suppose you have an object with zero for the value of all the derivatives of position. In order to get the object moving you would need to increase the value of the velocity from zero to some finite value. A change is velocity is acceleration, so the value of the acceleration would have to increase from zero to some value. You would also need to increase the jerk from zero to some value to have a change in acceleration.  Is there an infinite series of higher derivatives of position for this to work? Or am I missing something? Why is Excel truncating my 16-digit numbers? If I type in a 16 digit number (format: number, no decimals) it changes the number on me. Example: 1234567812345678 changes the view to 1234567812345670.    If I type it in as a general format it changes the numbers above so it displays 1.23457E+15 but if you click on the cell, the display shows the last digit as a 0 instead of an 8 once again.   I opened the file on a different computer and same issue now with it.  I have changed the auto correction and auto formatting all to no avail.  Help! Apex:OutputText to Currency Format from String Wrapper is there a way to pass a string to the &lt;apex:outputText&gt; so that it can be formatted as a currency or percent value?  Here's what I have inside a column of my visual force table:  &lt;apex:outputText value="{0, number, currecny}"&gt; &lt;apex:param value="{!row.values[1]}" /&gt; &lt;/apex:outputText   this gives me an error at runtime (when the visual force page loads), which I think may be some kind of type mismatch, where &lt;apex:outputText&gt; is expecting a Decimal or number but I am passing a string.  This is the error at runtime:     The value attribute on  is not in a valid format. It must be a positive number, and of type Number, Date, Time, or Choice.   Thanks (I'm aware of  but it has no answers…)  Let be $u_0 \in \mathbb{R}$ and the sequence $(u_n)_n$ defined by: $u_{n + 1} = \frac12 \arctan(u_n)$.  I define also: $v_n = 2^n u_n$, so I can show that: $\lim (u_n)_n = 0$ (by studying $x \mapsto \frac12 \arctan(x)$), thus, I can show that $(v_n)_n$ is monotone and converges because it is bound.  Now, I conclude: $u_n \sim \dfrac{l}{2^n}$, I'd like to determine $l$ more precisely.  Here is what I tried, I suspect $l$ to be something like $f(\pi)$ for some $f$ :   push the asymptotic expansion of $\arctan$ to the 2nd order and reinject it ; use $\arctan(u_n) + \arctan(1/u_n) = \dfrac{\pi}{2}$ ; use series techniques to look for $\sum v_{n + 1} - v_n$, maybe conclude using Cesaro summation VHDL Transition Function I have B1/B2 Visa. Can I travel for Business trip to US with this Visa? Why are trivial edits discouraged? Looking at  privilege, I find this to be a surprising requirement:  Try to make the post substantively better when you edit, not just change a single character. Tiny, trivial edits are discouraged.  What motivated this, or rather, what does this mean exactly? Does that, for example, include removing stuff like &quot;Hi, all&quot;, and &quot;thanks in advance&quot;? [update] I was led to a  talking about this topic, but it has a million Comments, and doesn't really justify the rule (unless it's hidden in those million Comments). However, looking at Jeff's Comments gives me an idea that this was meant as a general guideline, instead of a hard-and-fast rule: If you edit a post, check elsewhere on that post if there are other improvements that can be made. I'm a C++ guy learning Java. I'm reading Effective Java and something confused me. It says never to write code like this:  String s = new String("silly");   Because it creates unnecessary String objects. But instead it should be written like this:  String s = "No longer silly";   Ok fine so far...However, given this class:  public final class CaseInsensitiveString {     private String s;     public CaseInsensitiveString(String s) {         if (s == null) {             throw new NullPointerException();         }         this.s = s;     }     :     : }  CaseInsensitiveString cis = new CaseInsensitiveString("Polish"); String s = "polish";    Why is the first statement ok? Shouldn't it be   CaseInsensitiveString cis = "Polish"; How do I make CaseInsensitiveString behave like String so the above statement is OK (with and without extending String)? What is it about String that makes it OK to just be able to pass it a literal like that? From my understanding there is no "copy constructor" concept in Java? Only actions taken are displayed on question while checking the history of Low Quality Posts review How can I make a plane's edges taper inwards? How can I deform one edge or multiple edges of a plane or cube so they are tapered in and rounded equally? Do Thorncaster Sliver's triggered abilities go on the stack? I was guessing, since you actually target things instead of just dealing damage (similar to ), 's triggered abilities would actually go on the stack.  This came up in a separate game this past Friday when the Sliver deck attacked with two s, one , and two s while his opponent had a  as well as some 2/2.  The reason this even came up was because, if the triggers went on the stack, you could target things so they resolve in the following order:   Predatory Sliver targets Blood Artist, killing it. Predatory Sliver targets the 2/2, dealing one damage to it. Thorncaster Sliver targets the 2/2, killing it. and 5. Both Manaweft Slivers target the player, dealing one damage each to him. Most riders seem to say it's their groin, neck or lower back that starts hurting first after a decent distance has been ridden. For me it is my wrists.  I have no history of wrist pain (strains, breaks etc) so it can't be explained by that and I try to adjust my hand positions across my handlebars as often as I can.  My question has 2 parts:   1. Is there anything I can do to minimise pain in terms of riding position, gloves, exercises etc which will reduce soreness?  2. Why might this pain be occurring?  *I do all of my riding on paved roads on a road (Specialized Allez) bike. Run a GUI program at startup I am using Ubuntu 14.04. I wrote a small script named trial. The contents of the script are as follows:   #!/bin/sh SHELL=/bin/sh PATH=/bin:/sbin:/usr/bin:/usr/sbin      sh -c firefox   I copied the script to /etc/init.d, modified permission using chmod +x trial and used update-rc.d trial defaults. The file made link but when I rebooted the machine. It did not run firefox. I tried cron @reboot but with no success. I tried rc.local too again failure. How does "virus been detected" on android pop up on chrome when visiting some sites? What is the cause of this chrome bug on android? The last site I went to was www.destructoid.com and all of a sudden it gets redirected to the following url. This happened previously awhile back, but I didn't document everything as I did today. I'm also on android chrome canary if that matters.   I took some screenshots before closing out of that tab. But my question is:   What chrome bug or malware is causing these random redirects? How can one detect if they have this vulnerability?   The url is: Merging columns from two separate files How do I integrate the following? $\int{\frac{(1+x^{2})\mathrm dx}{(1-x^{2})\sqrt{1+x^{4}}}}$ What are the similarities/differences between the behaviors of Quantum particles and bouncing droplets?