I am trying to ask the user for a simple 'yes' or 'no' response using:  Scanner user = new Scanner( System.in );  String response = user.nextLine();   I am then using the value of 'response' in a series of IF statements to output a specific piece of text.  However every time I enter in a response the program just terminates and I'm not sure what I am doing wrong.  Here's all of the code to make things more clear:  import java.util.Scanner;  public class vedant {  public static void main (String args[]){     System.out.println("Is it past 11.30pm?");     Scanner user = new Scanner( System.in );     String response = user.nextLine();     if (response == "yes") {         System.out.println("tut tut tut...");         user.close();     } else if (response == "no") {         System.out.println("Good boy");         user.close();     } }   }  BTW I'm new to Java so sorry if this is quite a basic mistake.
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?
When to use “that” and when to use “which”, especially in relative clauses When is it appropriate to use that as opposed to which with relative clauses? I've got two branches that are fully merged together. However, after the merge is done, I realise that one file has been messed up by the merge (someone else did an auto-format, gah), and it would just be easier to change to the new version in the other branch, and then reinsert my one line change after bringing it over into my branch. So what's the easiest way in Git to do this? Minimize absolute values of errors instead of squares Same e-mail user, different address? Please anyone tell me when we have to use "has been, have been , had been" and something  started in past and still continuing is it possible to use has been ? How to make excel automatically fill a value in a cell of a sheet when another corresponding cell of another sheet is filled the same value? If an email message contains an email address in the body, Gmail automatically converts it into a mailto: link, which is helpful.  And many times each day I've enjoyed being able to right-click a mailto: link in an email (within Gmail) and then click "Copy email address" in the context menu.  Then I can paste that email address into a program (such as when I want to search a database).  However, within the past month or so, I've noticed that I can't right-click and click "Copy email address" without Gmail then popping open a "New Message" panel and changing my current URL to have ?compose=new at the end.  I wonder if it's related to .  How can I disable it?  I'm tried of having to click the "Discard draft" trash can button so many times throughout the day. I have this table definition as part of a invoice  \begin{tabularx}{\textwidth}[ht]{lXrr}%   It worked fine for years until I have a very short word in the X column for the first time. Now my table is very small in width and centered horizontally on the page.  In my expectation the X column should fill up all space until the width of the table reaches the width of the page except the margins.  I have read about workarounds specifying something like 1.2\textwidth, but I don't like that, because the table is a template included via \include, so it would affect all my invoices.  I also tried \linewidth, \hsize and \columnwidth, but everything results in the same layout.  Is there a way to make the only X column expand so that it uses all available space?    Complete included table definition (Rechnungstabelle.tex):  \newcommand{\Rechnungstabelle}[4]{% vielen Dank für Ihren Auftrag. \noindent \begin{tabularx}{\textwidth}[ht]{lXrr}% \toprule% \bf{Anzahl} &amp; \bf{Bezeichnung} &amp; \bf{Einzelpreis} &amp; \bf{Gesamtpreis} \\% \midrule% #1% \bottomrule% &amp; \bf{Rechnungsbetrag}  &amp; &amp; \bf{\EUR{#2}} \\% \ifthenelse{\equal{#3}{}}{}{&amp; Enthaltene MwSt. 19\% &amp; &amp; \EUR{#3} \\}% \ifthenelse{\equal{#4}{}}{}{&amp; * Enthaltene MwSt. 7\% &amp; &amp; \EUR{#4} \\}% \end{tabularx}% }   Changing the table header row to  \bf{Anzahl} &amp; \bf{Bezeichnung} \hspace{\textwidth} &amp; \bf{Einzelpreis} &amp; \bf{Gesamtpreis} \\%   is a workaround, but I don't think that would be good TeX style.  Minimum example for reproducing:  \documentclass[ fontsize=12pt,                  paper=a4,                 foldmarks=TBMPL,                 fromalign=center,                 ngerman                 ]{scrlttr2} \usepackage{babel} \usepackage[utf8]{inputenx} \usepackage[right]{eurosym} \usepackage{tabularx} \usepackage{ltablex} \usepackage{booktabs} \usepackage{ifthen}  \input{Rechnungstabelle} \begin{document} \begin{letter}  \Rechnungstabelle{     1,0 h &amp; Do something &amp; \EUR{99,00} &amp; \EUR{99,00} \\      }     {99,00}     {}{} \end{letter} \end{document} Proving the geometric sum formula by induction $$\sum_{k=0}^nq^k = \frac{1-q^{n+1}}{1-q}$$  I want to prove this by induction. Here's what I have.  $$\frac{1-q^{n+1}}{1-q} + q^{n+1} = \frac{1-q^{n+1}+q^{n+1}(1-q)}{1-q}$$  I wanted to factor a $q^{n+1}$ out of the second expression but that 1- is screwing it up... Java, Collection constructor Widget - unable to load a hot question, check your internet connection How do you cast a List of supertypes to a List of subtypes? Find the population size that maximizes the probability that two random samples of size $20$ will have exactly $2$ members in common Ten fish are caught in a lake, marked, and then returned to the lake. Two days later 20 fish are again caught, 2 of which have been marked.  (a) Find the probability of 2 of the 20 fish being marked if the lake has $k$ fish (assuming the fish are caught at random). (b) What value of k maximizes the probability?    Progress:     I got the (a), $$\binom{10}{2}\binom{k-10}{18}\bigg/ \binom{k}{20}$$ But how do I get part (b) where $k$ is to maximize the probability? Supersymmetry in Quantum Field Theory I have an idea of supersymmetry in quantum mechanics, can you suggest a book on "supersymmetry in quantum field theory", which has sufficient mathematical rigour like "Peskin and Schroeder" Is my way of solving and my answer correct?  Let $f(x)=x+\frac{x^2}{2}+\frac{x^3}{3}+\frac{x^4}{4}+\frac{x^5}{5}$   And $g(x)=f^{-1}(x)$  Find $g'''(0)$  My attempt:  We know that $g'(x)=\frac{1}{f'(g(x))}$  $f'(x)=1+x+x^2+x^3+x^4=\frac{x^5-1}{x-1}$  $f'(g(x))=\frac{(g(x))^5-1}{(g(x))-1}$  $\Rightarrow g'(x)=\frac{(g(x))-1}{(g(x))^5-1}$  $\Rightarrow g'(x)[(g(x))^5-1]=g(x)-1$  Similarly differentiating again,  $\Rightarrow g'(x)[5(g(x))^4]+[(g(x))^5-1]g''(x)=g'(x)$  Similarly differentiating again,  $\Rightarrow g'(x)[20(g(x))^3g'(x)]+[5(g(x))^4]g''(x)+[(g(x))^5-1]g'''(x)+g''(x)[5(g(x))^4]=g''(x)$  Putting $x=0$,  $g(0)=f^{-1}(0)=0$  $g'(0)=\frac{1}{f'(g(0))}=\frac{1}{f'(0)}=1$  similarly,$g''(0)=-1$  $\Rightarrow g'''(0)=1$ I'm about to start exploring the world of long exposure shots, using my Canon EOS M. The camera has a standard max exposure time of 30 seconds, but in bulb mode I can keep the shutter open indefinitely (using a wireless remote to control the shutter.)  How long can I leave the shutter open without running the risk of prolonged exposure to light damaging my sensor?  For the purposes of this question assume I'm shooting in summer daylight, so that we can go by the worst case. How can I diagnose and repair missing drive space? Can I programmatically open the devtools from a Google Chrome extension? Let $f \in C [a,b]$ such that $\forall x\exists y$ such that $|f(y)| \leq \frac{1}{2}|f(x)|$. Prove that $\exists c\in [a,b]$ such that $f(c) = 0$. What's the purpose of two capacitors in parallel? What's the purpose of the two capacitors in parallel on each side of the regulator in      I've seen similar setups in other similar circuits and can guess that it's related to one being polarized an one not, but I don't really understand what's going on there.