I have a simple piece of code to validate a username and a password.       public boolean isValid(String u, String p) {     if (u=="admin" &amp;&amp; p=="password1") {         return true;     } else if (u=="user" &amp;&amp; p=="password2") {         return true;     } else {         return false;     }  }   I've tried debugging it, and when it runs, u has the value "admin" and p has the value "password1", but it just skips the first condition. I must have done something wrong, but I can't figure out what.
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?
How to search only unanswered questions with an open bounty ? Why apt can't find the source code of any package? I use multiple displays, and the available options for Spaces that I am aware of allow surprise Space-switching, even when working in a completely different space.  Ideally, interacting with the Dock will only affect the same Space on the same display on which I used the Dock. This means:   If app clicked in Dock, and no copy of app is running on any space, then start the app and confine it to the current Space. If app clicked in Dock, and the program is already running in another Space, then either 1) open a new window if the program allows this, or 2) silently move the app to the current Space without disturbing or changing any other Space or display. If app clicked in Dock, and the program is already running in the current Space, then change focus to the app.   Specifically: - Clicking an icon in the Dock should rarely affect any other Space. - Clicking an icon in the Dock must never affect which Space is displayed on which display  OS X Yosemite 10.10.2, MacBook Pro 2012. (Dock set to auto-hide, and pops up at the bottom of any screen when I put the mouse there.) Tricks and tips for finding information in man pages Does anyone have any tricks and tips for finding information in man pages? Where can I ask a question about finding general software that meets certain requirements? How can I invert a 'clip' selection within TikZ? I wish to draw an arc for a reflex angle on the outside of a triangle with coordinates (A), (B) and (C).  If I wanted to draw the arc inside the triangle I could use something like  \begin{scope} \path[clip] (A) -- (B) -- (C) -- cycle; \draw (B) circle (2mm);    % this is the little angle marker \end{scope}   Is there a straightforward way to exclude the part of the circle that's in the triangle, as in the pseudo-code below?  \begin{scope} \path[magicalinverseclipcommand] (A) -- (B) -- (C) -- cycle; \draw (B) circle (2mm);    % this is the little angle marker \end{scope}   EDIT: Although I included the code above as a motivating example of what an inverse clip would do, I would prefer a general solution that works systematically with any closed path, and not just in the particular example of a triangle with a circle clipped out of it. Looking at my question, I realise this isn't clear, and I will be happy with the best solution to my particular problem, but wonder if there is a less ad hoc solution than those listed so far. How do I mount a hibernated NTFS partition? Singular or plural "set"? I'm having some issues with a sentence that is part of the purpose in a report that I'm writing. I'm not sure if the word "communicate" (in bold) should be singular or plural.  The applications in the "set" will communicate with each other, not with other "sets".     The purpose of this report is to develop a sample set of applications   that communicates between services on the internet, mobile devices   and a central processing unit in a motor vehicle. It seems that a number of the statistical packages that I use wrap these two concepts together. However, I'm wondering if there are different assumptions or data 'formalities' that must be true to use one over the other. A real example would be incredibly useful. How to get past a forgotten iPhone passcode? In Ubuntu, applications can be opened from a terminal. But sometimes it isn't clear what the appropriate command is to do this.  So, having an application open, how can I get the command used to launch it, without having to search anywhere (just by looking at it)? Deferring admission to a computer science graduate program Is B1 visa in perfect condition valid on old damaged passport? I got my US B1 visa last month on my Indian passport. Someone in my family wrote a phone number on one of the blank page of my passport. As my passport is damaged now, can I travel with my current passport to US or I should apply for new passport? Also, will B1 visa be valid on old damaged passport if I get new passport? Mixing plural and singular list items with a single verb A friend wants to write,   There is no hardware to purchase, no additional software to install and no key fobs to worry about.   This is awkward because the verb "is" doesn't match up with the third item, which is plural and demands "There are" as the subject. However,    There is no hardware to purchase, no additional software to install and there are no key fobs to worry about.   sounds awkward as well.  Is there a good workaround for this problem where some list items are singular and some are plural, so they don't share a common verb? Is the product of two non-holomorphic function always non-holomorphic? Suppose $h(z)$ is a complex function. I have noticed that $h(z) = f(z)\cdot g(z)$, where $f(z)$ and $g(z)$ are non-holomorphic. Can $h(z)$ be holomorphic?   Can a similar statement be made, if $f(z)$ is holomorphic, but $g(z)$ is not? How is using a transformer for isolation safer than directly connecting to the power grid? How is using a 1:1 transformer safer than using the mains straight off? Is it because you can limit the current coming from the transformer whereas straight from the mains its not current limited? I fail to see how its "safer" when playing with electricity is dangerous. Could someone please explain why it is considered safer to be isolated by a transformer. How do I get rid of this unwanted bar from Eclipse? What does 1x1 convolution mean in a neural network? I am currently doing the Udacity Deep Learning Tutorial. In Lesson 3, they talk about a 1x1 convolution. This 1x1 convolution is used in Google Inception Module. I'm having trouble understanding what is a 1x1 convolution.  I have also seen  by Yann Lecun.  Could someone kindly explain this to me? How strong of magnetic field would noticibly attract a person? There is iron in our blood, which is magnetic. Roughly how strong would a magnet have to be to induce a noticeable attraction? It would be nice to know this for several distances. Also, do electromagnets that strong exist? I wanted to add classpath to my JDK. While searching a way to do it I noticed everyone open .profile file using terminal. But when I want to open and edit it with a text editor I couldn't see that file in Home folder.  Can someone tell me why is this. And also if possible how can I access .profile in home folder the GUI way.