I was bored today so i thought i would go back to learning to code in Java. I thought of making a easy math quiz program where you have two random numbers that you need to multiply with each other.  import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Random;  public class Main {   public static void main(String args[]) throws IOException{     Random random = new Random();     int n1 = random.nextInt(30) + 5;     int n2 = random.nextInt(40) + 5;     int realanswer = n1 * n2;     String realanswer2 = Integer.toString(realanswer);     BufferedReader br = new BufferedReader(new InputStreamReader(System.in));     System.out.println("Answer these math questions:");     System.out.println("");     System.out.println(Integer.toString(n1) + " * " + Integer.toString(n2));     String answer = br.readLine();     if(answer == realanswer2){         System.out.println("CORRECT");     }else{         System.out.println("WRONG");         System.out.println("Answer is " + realanswer2);     }  }  }   My problem is that even if i write the right answer it says its wrong. I think the problem lies in the transition from int to String.  Any help appreciated.
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?
Let $R$ be a commutative ring with identity. Show that $R$ is a field if and only if the only ideals of $R$ are $R$ itself and the zero ideal $(0)$.  I can't figure out where to start other that I need to prove some biconditional statement. Any help? Copy a file back to local system with ssh If I'm logged in to a system via SSH, is there a way to copy a file back to my local system without firing up another terminal or screen session and doing scp or something similar or without doing SSH from the remote system back to the local system? When mounting an NFS share manually using mount and a path of the form &lt;domain/ip&gt;:&lt;path&gt;/&lt;path&gt; or &lt;domain/ip&gt;:/&lt;path&gt;/&lt;path&gt;, umount fails to find the path in /proc/mounts, despite the fact that the path is in fact listed in /proc/mounts.  This is the same problem as in this question:   Steps to reproduce:  # mount --version mount from util-linux 2.24.1 (libmount 2.24.0: debug, assert) # mkdir mountpath # mount 192.168.2.101:/devices mountpath # umount mountpath /home/.../mountpath was not found in /proc/mounts # grep mountpath /proc/mounts 192.168.2.101://devices /home/.../mountpath nfs4 rw,[snip],addr=192.168.2.101 0 0   How can I unmount this mount? How do I unit test (using xUnit) a class that has internal private methods, fields or nested classes? Or a function that is made private by having  (static in C/C++) or is in a private () namespace?  It seems bad to change the access modifier for a method or function just to be able to run a test. My boss gave me a task with completion date suppose 31 March, 2017and I completed on 28 February, 2017. Is it in time or before time. Is it correct to say "I wrote him" or "I wrote to him"?  My Mother was a stickler for English grammar and would say "I wrote your Uncle..." rather than "I wrote to your Uncle..." Why is $\Gamma\left(\frac{1}{2}\right)=\sqrt{\pi}$? It seems as if no one has asked this here before, unless I don't know how to search.  The Gamma function is $$ \Gamma(\alpha)=\int_0^\infty x^{\alpha-1} e^{-x}\,dx. $$ Why is $$ \Gamma\left(\frac{1}{2}\right)=\sqrt{\pi}\text{ ?} $$ (I'll post my own answer, but I know there are many ways to show this, so post your own!) I'm using Ubuntu 17.10 with GNOME 3. How can I show all open windows of a certain application using the sidebar (aka Ubuntu Dock)? Right now I have to right-click and select "all windows" to see my other open windows.   Is there a quicker way to do this? Why aren't people voting for questions? While at least some answers from every question seem to have been up-voted as a "helpful" answer:   about 49% of questions have score of 0 or 1. another 21% of questions have a score of 2.   Most questions seem to have an answer or two with score +5. Is it that we have a lot of fluff questions and not useful ones? Or perhaps it just seems more natural to vote for answers than questions? If we want the most useful info on Stack Overflow to filter to the top, how can this disparity be fixed?  I think this may cause real problems for people getting the badges which require +25 or +100 votes on questions.    I like a lot of the feedback I'm seeing. Two problems are highlighted:   The work flow doesn't promote voting for questions the way it promotes voting for answers. One solution: when a user answers a question, the system should invite them to vote for the question.  If someone cares enough to answer a question, then they care enough to vote for it as well. Users with less than 15 reputation cannot vote for questions or answers. Is this warranted?  Maybe these users could provisionally vote for questions and answers and those ratings would only take effect when the user reaches 15 reputation?   All I ask is this. As you browse Stack Overflow, when you see a good question: vote for it.  If everyone does, then this problem will disappear. How to remove illegal characters from path and filenames? Is there a closed form solution for the following series? (Without Using Gamma Function): $$ S=\sum _{i=1}^{n-1} \frac{1}{(i+1)!} $$ for $f\in L^1[0,2\pi]$ define $$\hat{f}(n)=\int_{0}^{2\pi} f(t)e^{-int} dt$$ for $n\in\mathbb{Z}$, $X$ is a closed linear subspace of $L^1[0,2\pi]$ such that $\sum_{n} |\hat{f}(n)|&lt;\infty$ for each $f\in X$, we need to show that there is $M&lt;\infty$ such that  $\sum_{n} |\hat{f}(n)|\le M\int_{0}^{2\pi}|f(t)|dt$ for each $f\in X$  please tell me how to solve this one, I have no clue. $X$,$Y$,$Z$ mutually independent implies $X+Y$ independent of $Z$ Supposing $X$, $Y$ and $Z$ and mutually independent real random variables, how can we prove that $X+Y$ and $Z$ are independent from the definition? If not from the definition, using $\sigma$-algebras?  I know that if $X$ and $Y$ are not independent this doesn't work so I know I have to make use of their independence in my proof but I can't figure out how. And it means that if I write the following, I'm making a mistake, and I can't find it:  $$\mathbb{P}(X+Y \leq k,Z \leq l)=\int_{\mathbb{R}} \mathbb{P}(X=x,Y \leq k-x, Z \leq l) dx=\int_{\mathbb{R}} \mathbb{P}(X=x,Y \leq k-x) \mathbb{P}(Z \leq l) dx = \mathbb{P}(Z \leq l)\int_{\mathbb{R}} \mathbb{P}(X=x,Y \leq k-x)dx= \mathbb{P}(Z \leq l) \mathbb{P}(X+Y \leq k) $$  PS: I have seen the proof here but it much more advanced stuff, kind of a sledgehammer... Why are two universal objects isomorphic? Not sure if this is a bug or a feature, but I noticed today that if I , it annoyingly one-boxes a link to the room, which is not a link to the info page! That's it. I'm gonna pack up and leave! Such annoyance! But for the time being,  Is this behavior expected? If so, what is the reason for changing the links? If this is really a bug since the responsible bot is not seeing parts of the URLs and ends up one-boxing, and hence linking to the wrong message, could this be fixed please? Worth pointing out that too much exposure to annoying things results in a higher blood pressure. The function auto.arima in the forecast package of R is a powerful tool to identify the best ARIMA(p,d,q) model for a given data series. In the   of the function, they report the following:  auto.arima(y, d=NA, max.p=5, max.q=5, max.order=5, max.d=2, start.p=2, start.q=2, ...)   According to the above function it seems that, by default, auto.arima tries to find the best model among all the combination having:   p equal or lower than 5 q equal or lower than 5 d equal or lower than 2 order equal or lower to 5, i.e. p + q + d  ≤ 5.   However, why does the default code stops at these conditions? Is there any particular reason why p, q and d should be equal or lower than 5, 5 and 2 and their sum lower than 5? How to deal with hierarchical / nested data in machine learning 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. Can a multiclass sorcerer/cleric use the Metamagic class ability with non-sorcerer spells? For example, using Twinned Spell when casting cure wounds to heal two creatures instead of just one? Negative Mass and gravitation