I'm fairly new to Java and am trying to create a text game, involving escaping. Here is my code:  import java.util.Scanner; import java.util.concurrent.TimeUnit; public class Adventure {     public static void main (String args[]) throws InterruptedException{         System.out.println("YOU WAKE ON YOUR COUCH. YOU NEED TO GET OUT OF YOUR HOUSE.");         int x = 1;         while (x == 1){              Scanner ACTION = new Scanner(System.in);             System.out.println("WHAT DO YOU DO NEXT?");             String action;             action = ACTION.next();              if (action == "a"){                 System.out.println("if");             }else{                 System.out.println("else");             }         }     } }   Try running and see that the if does not work, if you enter 'a', it prints 'else'. Please explain each new line of code (if any) in your answer. Thank you.
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?
I am interested in how uncertainty can be accounted for when considering the risk of extinction of a species. Forgive me for extending a rather tired thought experiment, but at least it's familiar territory and I hope it illustrates what I am trying to understand.  Let's say that Schrödinger was not satisfied with killing and not killing only one cat, so he went out and collected the last 15 remaining Himalayan Snow-Cats. He put each one in a box with a vial of poison, hammer, and a trigger device for releasing the hammer. Each trigger device has a known probability of releasing the hammer within any given hour, and the poison will take 5 hours to kill a cat (things got a bit trippy when he used radioactive decay, so this time he steers clear of quantum mechanics). After one hour, Schrödinger receives a notice from the ethics board telling him he's nuts and ordering him to release the cats immediately. He pushes a button which opens a cat-flap at the back of each box, thus releasing them all back into the wild. By the time the humane society check the boxes, all the cats have bolted. Before anyone can restrain him, Schrödinger detonates the remaining triggers, so nobody knows how many of the cats were poisoned.  The probability that each of the cats is poisoned is as follows:   0.17 0.46 0.62 0.08 0.40 0.76 0.03 0.47 0.53 0.32 0.21 0.85 0.31 0.38 0.69   After 5 hours have elapsed and all poisoned cats have died, what is the probability that there are:   (A) More than 10 Himalayan Snow-Cats still alive  (B) 10 or less still alive (C) 5 or less still alive (D) 2 or less still alive I understand that a black hole bends the fabric of space time to a point that no object can escape.   I understand that light travels in a straight line along spacetime unless distorted by gravity. If spacetime is being curved by gravity then light should follow that bend in spacetime.  In Newton's Law of Universal Gravitation, the mass of both objects must be entered, but photon has no mass, why should a massless photon  be affected by gravity in by Newton's equations?  What am I missing? How to add System.Windows.Interactivity to project? jQuery autocomplete tagging plug-in like StackOverflow's input tags? Are there rules for falling in water vs. diving vs. just jumping in for various depths of water? What do the colors mean in htop? Currently, when rep is changed due to the removal of another user account (to undo the rep gain/loss that happened when they up-/down-voted/accepted/were downvoted by you), the associated message is simply "User was removed". I am not the only one who found that message rather cryptic (I had to go search meta when I saw it, and I found my answer in a duplicate, so that makes me at least the 3rd person to not understand it).  I think it's a good idea to add a link to  or some more descriptive text to that.  Edit: e.g.     Another user was removed; reputation changes linked to the user's activity were reverted.   (I can see how it's hard to fully explain the event succinctly, that's why a "what is this?" link to meta or an FAQ question/answer might be better.) Script access to tangent and bitangent, per face: how? Suppose you have a mesh; you go into Edit mode,  set Transform Orientation to Normal,  show 3D manipulator widget, Pivot Point = Active Element, face select mode, and then you select any one face: immediately you will see a blue arrow representing the face normal, and also a red and a green arrow representing the face's tangent and bitangent.  What is the most straightforward way to refer  to said tangent and bitangent vectors from a Python script? The API documentation confuses me with loops and uv's, yet, clearly, Blender assigns a tangent and bitangent to each face without hesitation! I am going to start a phd at the US with an F1 visa. University told me that I could enter the US only 30 days before the date on I-20. Since English is not my first language (and this would be a big change in my life) I would like to go there by June.  The thing is that I have an European passport with a valid ESTA. My plan would be to arrive with this passport, stay 4-6 weeks , go to Canada for a short vacation (maybe flight maybe by land) and come back to the USA with F1 visa.  I have two questions about this:  1) is this possible?   2) If yes, how could I justify knowing I will lose my come-back flight during my first entry? (I would purchase round trip because one-way are too expensive, probably with less than 90 days difference) Show bigger amplitude of physical pendulum means bigger period Suppose you have a physical . It is true that as amplitude increases, the period increases. Can we demonstrate this fact without explicitly finding the period (which is pretty involved and pretty messy) in:    an intuitive fashion,  rigorously? I have this struct:  struct Map {     public int Size;      public Map ( int size )     {         this.Size = size;     }      public override string ToString ( )     {         return String.Format ( "Size: {0}", this.Size );     } }   When using array, it works:  Map [ ] arr = new Map [ 4 ] {     new Map(10),     new Map(20),     new Map(30),     new Map(40)};  arr [ 2 ].Size = 0;   But when using List, it doesn't compile:  List&lt;Map&gt; list = new List&lt;Map&gt; ( ) {     new Map(10),     new Map(20),     new Map(30),     new Map(40)};  list [ 2 ].Size = 0;   Why? Why $\sum_{k=0}^m x^k $ is equal to $\dfrac{x^{m+1}-1}{x-1} $? Who can help me proving this (but you can no longer use $\sum$ in the proof):  $$\sum_{k=0}^m x^k=\dfrac{x^{m+1}-1}{x-1}$$ How to make the taskbar blink my application like Messenger does when a new message arrive? I would like to remove selected commit log entries from a linear commit tree, so that the entries do not show in the commit log.  My commit tree looks something like:  R--A--B--C--D--E--HEAD   I would like to remove the B and C entries so that they do not show in the commit log, but changes from A to D should be preserved. Maybe by introducing a single commit, so that B and C become BC and the tree looks like.  R--A--BC--D--E--HEAD   Or, ideally, after A comes D directly. D' representing changes from A to B, B to C and C to D.  R--A--D'--E--HEAD   Is this possible? if yes, how?  This is a fairly new project so has no branches as of now, hence no merges as well. Block quote with big quotation marks i'm surprised there is so little documentation on this issue. But i'm trying to duck the audio on all the mix buses in Unity so that you can clearly hear the VO of the game.  Now it works great except that I have some reverb zones in the game and any sound that plays in these reverb zones, the actual reverb itself is NOT DUCKED.  So the VO is accompanied with a huge wall of wishy washy muddy noise.  Anyone deal with this before? How can we deal with this? How do I erase an iPhone? I had an iPhone on loan from a friend to try it out and now I need to give it back. How do I make sure that everything is erased from it? SMS, Calendar, Phone Logs, contacts? The Maximum possible order for an element $S_n$ I remember reading a sci-fi story where astronauts visit a planet, which is covered in stationary aliens with mile long necks that filter feed from the atmosphere.  It was published between 1960 and 2000.    It was in English and involved a pair of astronauts that went from planet to planet on a tour or something, though I don't know details of any other planets they visited. getting exception while putting list data into the map