If else statement not working JAVA The line starting the if statement is causing me issues. When I run it it will ask me my gender, I say boy and it says 'you cannot enter'. It doesnt even ask for the age!      import java.util.Scanner;    class Apples {   //////Main Method     public static void main (String[] args) {       if (Apples.getGender() == "boy" &amp;&amp; Apples.getAge() &gt; 17) {          System.out.printf("You can enter");     }     else {          System.out.printf("You cannot enter");     } }  /////Two Methods                 public static String getGender() {          Scanner newGender = new Scanner(System.in);         System.out.println("What gender are you?");              String genderMF = newGender.nextLine();             return genderMF;          }      public static int getAge() {          Scanner newAge = new Scanner(System.in);         System.out.println("What age are you?");             int ageMF = newAge.nextInt();         return ageMF;      } }
How do I compare strings in Java? 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?
Sci Fi action movie where an elite group of people control business through a game they play online I saw a movie where people are running from a group of powerful killers or a naughty company/organization.  A woman was hired to find the entity/company. A very overweight Asian man talks to them on line at one point. (When I say overweight, I mean 400 pounds plus)  He talks to a virtual dolphin and tells it he is sorry but he cannot play with the dolphin that day. Eventually, the people find the fat guy in real life. He is sitting on a Chinese style boat in a river (I think it was a river). (He is sitting in the rear of the boat. The boat is rather small. He is wearing a loin wrap like a sumo wrestler. In fact, I should most likely call him a sumo wrestler to describe the look.)  He had implants and wires coming out of his head like the Borg Queen did.  There is another part in the movie, where he replies to someones concern, saying, "I live a life of wonder..." (or something similar).  By the time the movie is over, the evil force has caused his death. A team of Yakuza style (might actually be the Yakuza) commandos tear through everything trying to stop the truth from being discovered. The huge Asian man ends up leaving little messages, like parts of himself, to guide the woman to the truth. The ending reveals the naughty company/organization is a group of elite power brokers that control business by playing a game. Corporations lose or gain ground over nothing more than the turn of a game. (Including totally going out of business or making a fortune from nothing.)  Do you have any idea what movie this was? write data line by line on iphone Why is ++i considered an l-value, but i++ is not? When needing to ask a professor about something important and potentially delicate, what is an appropriate way to phrase the question or write the email?  Examples include:   Requesting a recommendation letter Asking for exceptions to policy (e.g., ignoring a course prerequisite, rescheduling an exam) Asking if you can do research with them, join a group, get into a program Scheduling a meeting, exam, or defense Letting them know about a change of plans Letting them know about a life event affecting your work or studies (e.g., wedding, funeral, sickness, vacation) Is there a way to access an iteration-counter in Java's for-each loop? Is there a way in Java's for-each loop  for(String s : stringArray) {   doSomethingWith(s); }   to find out how often the loop has already been processed?  Aside from using the old and well-known for(int i=0; i &lt; boundary; i++) - loop, is the construct  int i = 0; for(String s : stringArray) {   doSomethingWith(s);   i++; }   the only way to have such a counter available in a for-each loop? A lot of textbooks and exam boards claim that light incident at exactly the critical angle is transmitted along the media boundary (i.e. at right-angles to the normal), but this seems to violate the principle of reversibility in classical physics.  How would a photon or ray travelling in the reverse direction "know" when to enter the higher refracting medium?  It can't know, so I conclude that such light is simply reflected?  Is this correct? Is there an MD5 Fixed Point where md5(x) == x? Is there a fixed point in the MD5 transformation, i.e. does there exist x such that md5(x) == x? Are there wizarding schools in the rest of the "magical" world? Are there other schools for witches and wizards in the rest of the world? In the books they only speak of 3 schools, but what about Asian or American people?  And even more, were they affected by the events happening in Europe? Error while updating debug log trace flag I am trying to update the debug log trace flag for my user but getting the following error     Having an active trace flag triggers debug logging. You have 259 MB of the maximum 250 MB of debug logs. Before you can edit trace flags, delete some debug logs.   I have removed all existing debug logs but it is still throwing the error. Backup with duplicity on Google Cloud Storage I have already set a backup routine that backups all my files to Amazon S3 using duplicity. I would like to create a similar backup routine with Google Cloud Storage. Is it possible to get duplicity to work with GCS? How can one use multi threading in PHP applications Is there a realistic way of implementing a multi-threaded model in PHP whether truly, or just simulating it. Some time back it was suggested that you could force the operating system to load another instance of the PHP executable and handle other simultaneous processes.  The problem with this is that when the PHP code finished executing the PHP instance remains in memory because there is no way to kill it from within PHP.  So if you are simulating several threads you can imagine whats going to happen.  So I am still looking for a way multi-threading can be done or simulated effectively from within PHP. Any ideas? (exercise from Tao's analysis book) Proof of a lemma relating to power set of X I am trying to show that if $n$ is an odd natural number, then $8$ divides $n^{2}-1.$ I was able to prove that because I know that if $n$ is an odd natural number, then $n^{2}$ can be written as $8k+1$ for some $k\in \mathbb{N}.$ I would like to show this question by using the Euclidian division. Then I wrote $n^{2}-1=8k+r$, where $0\leq r  &lt; 8.$ When $r=2$ we get $n^{2}-1=8k+2.$ Since $n$ is odd, then $n^{2}-1$ is even and I got stuck. Is there way to fix that? If $A$ and $B$ are compact subsets of $\mathbb R$, then so is $\frac{A}B$. Given compact $A,B \subseteq \mathbb{R}$ with $\alpha := \inf(B) &gt; 0$, define $$\frac{A}B := \left\{\frac{x}y : x \in A  \text{ and } y \in B\right\}.$$ Show that $\frac{A}{B}$ is compact.  I am thinking of using the following result given in a previous exercice but I don't know how to proceed.     $K \subset \mathbb R^n$ is compact if and only if for all $\{x_{n}\}$ such that $\{x_{n} : n\in \{1,2,\dotsc\}\}\subset K$, there exists a convergent subsequence $\{{x_{\phi(n)}}\}$ that converges to a limit $l \in K$.   When does the infimum come into place? Why can't we initialize members inside a structure? 1) a ten years old boy is sitting on the couch.      2) a ten year old boy is sitting on the couch.      3) a ten-years old boy is sitting on the couch.      4) a ten-year old boy is sitting on the couch.   Which is correct? Redirect the output of a command in `time command` I am trying to time something using:  /usr/bin/time myCommand   However, since /usr/bin/time writes to stderr, if myCommand also writes to stderr, I will get more than just time's output on the stream. What I want to do is, redirect all of myCommand's output to /dev/null, but still write time's output to stderr. Using an example myCommand that writes to stderr of ls /nofile, we see that (obviously) there is no output at all with the following:  $ /usr/bin/time ls /nofile 2&gt; /dev/null $   Without any redirection, we see both the output from ls (to stderr) and the output from time (also to stderr):  $ /usr/bin/time ls /nofile ls: cannot access /nofile: No such file or directory 0.00user 0.00system 0:00.00elapsed 0%CPU (0avgtext+0avgdata 3776maxresident)k 0inputs+0outputs (0major+278minor)pagefaults 0swaps   What I want is something that simply produces:  $ /usr/bin/time ls /nofile &gt; RedirectThatImAskingFor 0.00user 0.00system 0:00.00elapsed 0%CPU (0avgtext+0avgdata 3776maxresident)k 0inputs+0outputs (0major+278minor)pagefaults 0swaps   Any ideas? A Hilbert space is, by definition, a complete inner product space. If $(V,|.|)$ is finite dimensional inner product space of dimension $n$ then it is (topologically) isomorphic to $\mathbb{R}^n$ which is of course complete. My instinct here is to say "and therefore, $V$ is also a Hilbert space". I'm not sure about this step however since completeness depends on the norm and the norm depends on the selected inner product (assuming the induced norm $||x|| = (x | x)^{1/2}$ is used). So, must we place some condition on the inner product or is the topological isomorphism between $\mathbb{R}^n$ enough to guarantee that V is Hilbert? Stack Exchange doesn't allow me to answer protected questions because I gave away earned rep in bounties I want to show without using Sylow theorem that     Any group of order $2p$ has a subgroup of order $p~$($p$ being a prime)   My attempt: Since $|G|=2p,$ even $\exists~a\neq e\in G$ such that $a^{-1}=a.$ Then $H=\{e,a\}\leq G.$ Let $S$ be the set of all left cosets of $H$ in $G.$ Now $S$ forms a group w.r.t. the composition $g_1Hg_2H=(g_1g_2)H.$ The mapping $\sigma:S\to G:gH\mapsto g$ is an $1-1$ homomorphism. Then $S\simeq\sigma(S)\leq G.$ Thus $G$ has a subgroup of order $p.$  Please tell me whether I'm right!     I'm skecptical as I didn't use that $p$ is prime.