Hello i'm writing a simple username/password input from the user, but my code is bypassing all the if/ if else statements and going to the else statement. I'm not sure if my syntax is incorrect or whether using an if/else statement is incorrect. Or if I just coded wrong. Please help!  import java.util.Scanner;  public class Passwords {     public static void main (String[] args)     {         Scanner input = new Scanner(System.in);         String[] username = {"admin1", "admin2", "admin3", "admin4", "admin5"};         String[] password = {"pass1", "pass2", "pass3", "pass4", "pass5"};         System.out.println("Please enter in one of the following usernames : admin1, admin2, admin3, admin4, or admin5");         String userinput = input.nextLine();         System.out.println("Please enter in the password corresponding to your username: pass1, pass2, pass3, pass4, or pass5");         String passinput = input.nextLine();         if (userinput == username[0] &amp;&amp; passinput == password[0])         {             System.out.println("Access granted!");         }         else if (userinput == username[1] &amp;&amp; passinput == password[1])         {             System.out.println("Access granted!");         }         else if (userinput == username[2] &amp;&amp; passinput == password[2])         {             System.out.println("Access granted!");         }         else if (userinput == username[3] &amp;&amp; passinput == password[3])         {             System.out.println("Access granted!");         }         else if (userinput == username[4] &amp;&amp; passinput == password[4])         {             System.out.println("Access granted!");         }             else              {                 System.out.println("Sorry the username or password you entered is incorrect. Please try again");                 System.out.println("Please enter in one of the following usernames : admin1, admin2, admin3, admin4, or admin5");                 String userinput1 = input.next();                 System.out.println("Please enter in the password corresponding to your username: pass1, pass2, pass3, pass4, or pass5");                 String passinput1 = input.next();                 if (userinput1 == username[0] &amp;&amp; passinput1 == password[0])                 {                     System.out.println("Access granted!");                 }                 else if (userinput1 == username[1] &amp;&amp; passinput1 == password[1])                 {                     System.out.println("Access granted!");                 }                 else if (userinput1 == username[2] &amp;&amp; passinput1 == password[2])                 {                     System.out.println("Access granted!");                 }                 else if (userinput1 == username[3] &amp;&amp; passinput1 == password[3])                 {                     System.out.println("Access granted!");                 }                    else if (userinput1 == username[4] &amp;&amp; passinput1 == password[4])                 {                     System.out.println("Access granted!");                 }                 else                  {                     System.out.println("Sorry, your username/password does not match our database. Contact the administrator.");                 }             }         } }
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?
Prove: The pre-image of an ideal is an ideal. Let $\phi : R \to S$ be a homomorphism. If $N$ is an ideal of $S$, then $\phi ^{-1} (N)$ is an ideal of $R$. Proving identities (mod $pq$) using Fermat's little theorem? Is there evidence of dark matter in our galaxy? Is there evidence of dark matter in our galaxy?  How can we measure this, say, how many percent of the center of our galaxy is dark matter?  I did not find the answer in the question When and what cause Voldemort to look the way he does, vs how we've seen him as a teen? As the title says, when and what made Voldemort look the way he does (pale, snake-like etc) as opposed to how we've seen him in his earlier years as Tom Riddle? Is it just a side effect of his unnatural resurrection? Before he died attacking Harry as a baby did he look like a normal guy? What do people who are using a pensieve look like? As far as I remember from the books, there's no description of what a person using a Pensieve looks like. When Harry is using the Pensieve, he describes it as if he were falling into it, but it's never stated whether his body really enters the Pensieve, because the experience is just told from his point of view.   Now let's say Dumbledore enters his office while Harry was using the Pensieve -- what would Dumbledore see? Is there an answer in the books/canon? The age of the universe Many times I have read statements like, "the age of the universe is 14 billion years" . For example this wikipedia page .   Now, my question is, which observers' are these time intervals? According to whom 14 billion years? Why is "cupboard" pronounced with a silent "p"? According to Google at least, the word "cupboard" originated in late Middle English as denoting a board that held cups. Since then, the word has evolved to mean a kind of cabinet.  My question is, given its origin and spelling, why do we pronounce "cupboard" with a silent "p"? Has the pronunciation simply evolved because "cup-board" is too awkward to say, or is there a deeper pronunciation rule that I'm not aware of? When wouldn't I use LASSO for model selection? Is it possible to install Ubuntu through network? I would like to install Ubuntu  for almost 120 users. But it's very difficult in using USB and drives.  Any suggestions? Why do airplanes experience negligible Coriolis force while bullets experience the Coriolis force in long range shooting, even though the mass of airplane is much bigger than a bullet? Fourier transform of $\exp(-t^2)$ using contour integration. Gradient steepest direction and normal to surface? From this , I now understand the gradient to be the directional derivative that returns the steepest slope at a point. However, reading my textbooks, they all say that the gradient is normal to the tangent plane. In the above SE question, the gradient sounds like it should be parallel to a direction in the $xy$ plane, not actually up on the surface.   My question is therefore do I have a misunderstanding of the tangent plane, gradient or directional derivative?   In addition, I question how the gradient always passes through the origin or the $xy$ plane? If for instance in the graphic, the gradient had been another direction (say horizontal), then it wouldn't pass through the origin! In addition, the gradient of other points in the graphic would satisfy this example. Many thanks! Can the Telekinesis spell be used to manipulate liquids? Why does main method in Java always need arguments? Windows 7 + Deep Freeze - I'm stuck in an endless reboot loop I have the following setup:   Windows 7 Ultimate Deep Freeze   I "thawed" my machine last night and performed a Windows Update. The update is having issues (it gets stuck at 32%, fails, and restarts my machine). When it reboots it attempts it again, and again, and again, etc. (Endless loop).  I looked online and found some solutions, but none of them seem to be working:   When I run Safe Mode, Safe Mode w/ Network, or Safe Mode w/ Command Prompt it attempts to revert the Windows Update changes. However, the problem is with Deep Freeze on (and now in "Frozen" mode) the reverted changes don't stay, and I'm back into the loop of death. Oh, and side note: "Safe Mode w/ Command Prompt" does not actually take me to a command prompt window? Perhaps because it is attempting to complete the Windows Update changes first? I have tried to select the option to NOT restart when an windows error occurs, but it still does. I tried the remainder of all the other options in the F8 screen.     The only other option left is to find my Windows 7 Media Disc (I can't find it right now) and use it to repair windows (because for some reason the repair option does not show up in the F8 screen).  Is there a way to disable Deep Freeze from loading? When I selected "Safe Mode w/ Command Prompt" I noticed that it loads the DpFrz.sys file. I know that when I'm in the Windows Boot Manager if I press F10 instead of F8 (while highlighting Windows 7) it takes me to an "Edit Boot Options" screen:     Edit Windows boot options for: Windows 7      Path: \Windows\system32\winload.exe      Partition: 2 Hard Disk: 8e90e329      [ /NOEXECUTE=OPTIN (I CAN EDIT THIS LINE)   ]     Update: I found my Windows 7 Media Disk and it did not help out. The laptop had the "System Restore" as a partition on the HDD. I later received (in the mail) a Windows 7 Upgrade Disc from Sony to upgrade my system from Windows Vista to Windows 7 Ultimate. I placed the disc into the DVD drive and it does not come up as a "bootable" disc. I'm going to try to find an alternative disc to see if I can get into Command Prompt.    Update 2: I got a Windows Repair disc and got into a command prompt window. I got into the registry and disabled Deep Freeze. Also:   I renamed the Pending.xml file to Pending.old I cleared out the Windows Temp directory   I still am stuck in the loop (though, it isn't an issue with DeepFreeze anymore because I can make changes to the hard drive and they persist). Not sure what to do at this point?    Update 3: I ran the repair option and it couldn't repair, but it did point me to something. It says the error was due to a driver that was failing. I have a feeling it is my UPEK Fingerprint scanner. Are Destiny characters backwards and/or cross-compatible? From what I heard and remember hearing correctly, characters that are leveled up through the PS3 can be transferred to the PS4 version (assuming that both consoles have the game).  So what if I wanted to go back to the PS3 version with some friends? I only have the PS4 version at the moment--would my PS4 characters transfer over to the PS3 side? What if I wanted to go to the 360 version too to play with some other people too? Test for finite variance? Is it possible to test for finiteness (or existence) of the variance of a random variable given a sample? As a null, either {the variance exists and is finite} or {the variance does not exist/is infinite} would be acceptable. Philosophically (and computationally), this seems very strange because there should be no difference between a population without finite variance, and one with a very very large variance (say > $10^{400}$), so I am not hopeful this problem can be solved.  One approach that had been suggested to me was via the Central Limit Theorem: assuming the samples are i.i.d., and the population has finite mean, one could check, somehow, whether the sample mean has the right standard error with increasing sample size. I'm not sure I believe this method would work, though. (In particular, I don't see how to make it into a proper test.) How do I determine if my integrated Intel graphics support "Shader Model 3"? I am trying to play a Steam game on Ubuntu.  The game requires "Graphics: Shader model 3".  How do I determine if my integrated Intel graphics support Shader Model 3?  At present, when I launch the game, I hear the audio, but the screen is entirely black.  Running glxinfo | grep OpenGL yields:  OpenGL vendor string: Intel Open Source Technology Center OpenGL renderer string: Mesa DRI Intel(R) Haswell Mobile  OpenGL core profile version string: 4.5 (Core Profile) Mesa 18.2.2 OpenGL core profile shading language version string: 4.50 OpenGL core profile context flags: (none) OpenGL core profile profile mask: core profile OpenGL core profile extensions: OpenGL version string: 3.0 Mesa 18.2.2 OpenGL shading language version string: 1.30 OpenGL context flags: (none) OpenGL extensions: OpenGL ES profile version string: OpenGL ES 3.1 Mesa 18.2.2 OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.10 OpenGL ES profile extensions:   I am not sure which (if any) of the above lines answer my question. What apps are people using to record voice meetings on the iPad? I'm looking to do some light recording of voice conversations and field recordings on my iPad using the built in microphone.    seems to be the obvious Apple solution, but is too heavy for my needs. By the time I set up a new project, turn off the metronome, etc..., I find myself wishing I just had  running on my iPad.   I don't mind paying for the app, but wondered what people are using for both light voice recording as well as longer and more numerous recording / light editing where some tagging and filing might be possible. A rearrangement of an absolutely convergent complex series is also absolutely convergent I just completed the following proof.  Is it valid?   Let $\sum_{k=1}^{\infty} a_k$ be an arbitrary convergent series that also converges absolutely.  Then $\sum_{k=1}^{\infty} a_k \in \mathbb{C}$ and $\sum_{k=1}^{\infty} |a_k| \in \mathbb{R}$. Let $\{b_k\}$ denote a rearrangement of the $\{a_k\}$.  That is, we have that $\{a_k\} = \{b_k\}$ yet $a_i = b_i$ needn't hold. We will first show that $\sum_{k=1}^{\infty} b_k$ converges absolutely (immediately implying it converges non-absolutely).  We will use the Cauchy Criterion on the partial sums of $\sum_{k=1}^{\infty} |b_k|$ to demonstrate this. First let $\epsilon &gt; 0$. Consider that since $\sum_{k=1}^{\infty} |a_k| \in \mathbb{R}$, we have that $\exists N_1 \in \mathbb{N}$ s.t. for all $N_1 &lt; m &lt; n$ we have   $$ \sum_{k=m}^n |a_k| \le \epsilon. $$ Now let $0 &lt; N_2$ be large enough s.t $\{a_1, \ldots , a_{N_1}\} \subseteq \{b_1, \ldots , b_{N_2}\}$.  Let $M &gt; max\{N_1, N_2\}$.  Let $M &lt; m' &lt; n'$.  Then since $\{b_k\} - \{b_1, \ldots , b_{m'}\} \subseteq \{a_{N_1}, a_{N_{1}+1},  a_{N_{1}+2} \ldots\}$, we will have that   $$ \sum_{k=m}^n |a_k| \le \epsilon \implies \sum_{k={m'}}^{n'} |b_k| &lt; \epsilon. $$ Then we have that   $$ \left| \sum_{k={m'}}^{n'} |b_k| \right| = \sum_{k={m'}}^{n'} |b_k| &lt; \epsilon $$  so that since $\epsilon$ was arbitrary, we have obtained that   $$ \left| \sum_{k=1}^n |b_k| - \sum_{k=1}^m |b_k|  \right| = \left| \sum_{k=m}^n |b_k|  \right| \rightarrow 0 $$  so that via the Cauchy Criterion for Convergence  we have that $\sum_{k=1}^{\infty} |b_k|$ converges to some  value in $\mathbb{R}$ as desired. Then it follows that $\sum_{k=1}^{\infty} b_k$ is absolutely convergent (and hence also just convergent).   $\square$