I'm a new programmer and trying to teach myself Java by doing random projects. Below is a "Rock, Paper, Scissors" game and the issue that I'm facing is after printing "a", the program ends and does not continue onto the if else statements below. Any help that can be given would be greatly appreciated.  package com.company;  import java.util.Scanner;  public class Main {      public static void main(String[] args) {          System.out.println("Hello &amp; Welcome to Rock, Paper, Scissors. What's your name?");         Scanner scan = new Scanner(System.in);         String userChoice = scan.nextLine();         System.out.println("Hello, " + userChoice + ". Let's start a game!");         Scanner scan = new Scanner(System.in);         System.out.println("Choose one: Rock, Paper, Scissors");         String userFirstChoice = scan.nextLine();         System.out.println("You chose " + userFirstChoice);          double a = Math.random();         System.out.println(a);            if (a &gt;= 0.00 &amp;&amp; a&lt;= 0.3){             if ( userFirstChoice== "Rock"){                 System.out.println("Rock vs Rock: TIE");             }             else if (userFirstChoice == "Paper"){                 System.out.println("Rock vs Paper: YOU LOSE!");             }             else if (userFirstChoice == "Scissors"){                 System.out.println("Rock vs Scissors: YOU WIN!");             }          }         else if (a&gt;=0.3 &amp;&amp; a&lt;=0.6){             if(userFirstChoice == "Paper"){                 System.out.println("Paper vs Paper: TIE!");             }             else if (userFirstChoice == "Rock"){                 System.out.println("Rock vs Paper: YOU LOSE!");             }             else if(userFirstChoice == "Scissors"){                 System.out.println("Scissors vs Paper: YOU WIN!");             }          }         else if (userFirstChoice == "Scissors"){             System.out.println("Scissors vs Scissors: TIE!");         }         else if (userFirstChoice == "Paper"){             System.out.println("Paper vs Scissors: YOU LOSE!");         }         else if (userFirstChoice == "Rock") {              System.out.println("Rock vs Scissors: YOU WIN!");         }      }   }
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?
Is "I'm being angry" ungrammatical? Is it same number of candies for any stage of evolution while transferring pokemon to professor? I was just wondering if the number of candies we get while transferring the pokemon to professor is same for any stage of evolution ?   For example, you would get a pidgey candy for transferring a pidgey. Is it same number of candies for transferring pidgey, pidgeotto or pidgeot ? Seeking appropriate statistic to measure spatial autocorrelation of points with binary values I am trying to determine the level of spatial autocorrelation in a point dataset.  The attribute I'm interested in is binary (presence/absence of a species), for which Moran's I is not appropriate.  On the other hand, Joint Count statistics, which are typically recommended for binary or categorical data, apparently are not appropriate for point data. What is an appropriate statistic to measure global and/or local spatial autocorrelation of points when the attribute of interest is binary? Polynomial contrasts for regression I cannot understand the usage of polynomial contrasts in regression fitting. In particular, I am referring to an encoding used by R in order to express an interval variable (ordinal variable with equally spaced levels), described at .  In the example of , if I understood correctly, R fits a model for an interval variable, returning some coefficients which weights its linear, quadratic, or cubic trend. Hence, the fitted model should be:  $${\rm write} = 52.7870 + 14.2587X - 0.9680X^2 - 0.1554X^3,$$  where $X$ should take values $1$, $2$, $3$, or $4$ according to the different level of the interval variable.  Is this correct? And, if so, what was the purpose of polynomial contrasts? My Bridgestone MB-5 currently has a 7-speed rear wheel. I'd like to convert it to a 10-speed. Is this possible? Is it practical? Create ColorRamp How can I create a ColorRamp for a Cycles material through Python?  I am able to create a new shader output node with nodes.new(type='ShaderNodeOutputMaterial'). Searching online, I see that it is only possible through C code (however, these pages dates back several years).  Is there a way to fake a ColorRamp (maybe with multiple Math nodes in greater/less than mode) or create a ColorRamp for a Cycles material through Python? Compute $\iint\limits_R\frac{y}{x+y^2}dA$ where $R=[0,1]\times[1,2]$ Compute $\displaystyle\iint\limits_R\frac{y}{x+y^2}dA$ where $R=[0,1]\times[1,2]$  $\displaystyle\int_0^1\int_1^2\frac{y}{x+y^2}dydx=\int_0^1\int_1^2y(x+y^2)^{-1}dydx$  How do I integrate the denominator if the superscript is $-1$?   Hints are appreciated! $x^a - 1$ divides $x^b - 1$ if and only if $a$ divides $b$ Let $x &gt; 1$ and $a$, $b$ be positive integers. I know that $a$ divides $b$ implies that $x^a - 1$ divides $x^b - 1$. If $b = qa$, then  $$x^b - 1 = (x^a)^q - 1^q = (x^a - 1)((x^a)^{q-1} + \ldots + x^a + 1).$$  I'm interested in the converse of the statement. If $x^a - 1$ divides $x^b - 1$, does this imply that $a$ divides $b$? Divisibility Rule for 9 I'm working through an elementary number theory course right now and I think I've come up with a proof here but wanted some feedback on my logic.    Question:  If the sum of the digits in base 10 is divisible by 9, then the number itself is divisible by 9.    Proof: Suppose that $9|d_1+d_2+...+d_n$ then $d_1+d_2+...+d_n=0\mod9$  Now consider $d_1(10^{n-1})+d_2(10^{n-2})+...+d_{(n-1)}(10^1)+d_n(10^0)$ Each power of $10$ is equivalent to $1\mod9$   therefor  $d_1(10^{n-1})+d_2(10^{n-2})+...+d_{(n-1)}(10^1)+d_n(10^0)=(1\mod9)(d_1+d_2+...d_n)$  $9|(d_1+d_2+...d_n)$ by our assumption, thus $9|(1\mod9)(d_1+d_2+...d_n)$  Thus we have shown that if 9 divides the sum of the digits in base 10, 9 divides the number itself.    The only question I really have is whether I'm jumping the gun on my assumption concerning the powers of 10 being $1\mod 9$.  I think this is fair game here but not 100% confident.  Thanks. What does ** (double star/asterisk) and * (star/asterisk) do for parameters? I mean 100+ MB big; such text files can push the envelope of editors.  I need to look through a large XML file, but cannot if the editor is buggy.  Any suggestions? The two sentences here both indicate that, at some point in the past, I performed some work:   I did work I worked   What is the difference between these two sentences? Does constructing one with did and the other with a simple past change the meaning? Proving $\frac{1}{n+1} + \frac{1}{n+2}+\cdots+\frac{1}{2n} &gt; \frac{13}{24}$ for $n&gt;1,n\in\Bbb N$  To solve it I used induction but it is leading me nowhere my attempt was as follows:  Lets assume the inequality is true for $n = k$ then we need to prove that it is true for $k+1$  so we need to prove $\frac1{k+2} + \frac1{k+3}+\cdots+\frac1{2(k+1)} &gt; 13/24$  I don't know where to go from here please help. how to Query parent to child I have process in salesforce in such a way opportunity we can relate this opportunity to this lookup field parent_opportunity__c . Which relates opportunity to other parent opportunity.  I want to write a query parent to child :  select id,(select id from opportunity where parent_opportunity__c!=null) from opportunity where parent_opportunity__c=null   I have worked with different scenarios i cant able to crack it  select id,name,(select id,name from parent_opportunity__r) from opportunity this is showing error and   select id,name,(select id,name from opportunity) from parent_opportunity__c this is also error Why did Voldemort take the wand of one of his most loyal servants? In Harry Potter and the Deathly Hallows, chapter one The Dark Lord Ascending, Voldemort believes he must use a wand other than his own in order to kill Harry, when Harry is moved from Privet Drive. He demands Lucius Malfoy's wand, and gets it.   My question is, why did Voldemort take the wand of one of his most loyal servants, rendering Lucius Malfoy useless if a battle was to occur?  If I remember correctly, he had Ollivander at his disposal, and he was the one who told him to use another wand in first place. Why not ask Ollivander to create another wand, or just use ones that he had ready to sell in his shop at Diagon Alley? He could even have taken Ollivander's own wand. If my memories are correct, a wand's importance was compared to that of a limb. Cannot select vertices from different object while in edit mode Whenever I enter edit mode, with 2 separate meshes (cubes), I can only select vertices/edges/faces of 1 mesh.  Example (the screen shot did not include the mouse cursor):    Also, when I enter edit mode with both meshes selected, one of the meshes has a red border and cannot be selected (it also has this border in Object mode): My understanding is that a question is historically locked because the information in it is too valuable for the question to be deleted.   But if the "valuable information" becomes obsolete, what happens then?  We cannot modify the question content, or the answers for a historically locked question, right? Two different expansions of $\frac{z}{1-z}$ This is exercise 21 of Chapter 1 from Stein and Shakarchi's Complex Analysis.  Show that for $|z|&lt;1$ one has $$\frac{z}{1-z^2}+\frac{z^2}{1-z^4}+\cdots +\frac{z^{2^n}}{1-z^{2^{n+1}}}+\cdots =\frac{z}{1-z}$$and   $$\frac{z}{1+z}+\frac{2z^2}{1+z^2}+\cdots \frac{2^k z^{2^k}}{1+z^{2^k}}+\cdots =\frac{z}{1-z}.$$  Justify any change in the order of summation.   [Hint: Use the dyadic expansion of an integer and the fact that $2^{k+1}-1=1+2+2^2+\cdots +2^k$.]  I don't really know how to work this through. I know that $\frac{z}{1-z}=\sum_{n=1}^\infty z^n$ and each $n$ can be represented as a dyadic expansion, but I don't know how to progress from here. Any hints solutions or suggestions would be appreciated. Square root of Positive Definite Matrix Do I need to reboot my HTC Desire periodically?