I have this code, why bo3= st1 == st2  gives true ?   are not they in different position in the memory, and by == we compare the position whether  it is the same or not !  Also if there is something wrong, please indicate me. Thank you guys.  public static void main(String[] args) {      String st1 = "HELLO";     String st2 = "HELLO";     String st3 = "hello";       int comp1 = st1.compareTo(st2);  // equal 0     int comp2 = st1.compareTo(st3);  // -32      boolean bo1 = st1.equals(st2); //true     boolean bo2 = st1.equals(st3); // false , if ignoreCase will be true      boolean bo3 = st1==st2; //true    ??????????? should not be true     boolean bo4 = st1 == st3; //false       int ind1 = st1.indexOf("L"); // 2     int ind2 = st1.lastIndexOf("L"); // 3      boolean con = st1.contains("LLO"); //true       System.out.println(bo3); }   While I have another code when I enter "Mary", the result: Same name  and  not equal  public static void main(String [] args) {      Scanner keyboard = new Scanner(System.in);     System.out.print("What is your name? ");     String name = keyboard.next();      if (name.equals("Mary"))         System.out.print("Same name");     else         System.out.print("Different name");      if (name == "Mary")         System.out.println("equal");     else         System.out.println("not equal"); }
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?
Simple regular expression for a decimal with a precision of 2 How to start Skype 4 with Ubuntu 12.10? I've installed Skype and it's running all OK but I want it to start automatically when I log with my user.  How can I do that? How do I run an application with arguments from the command line without losing the terminal? I use dwm as a window manager on Ubuntu, I like tiled windows and I like them as few as possible. I sometimes need to run an application (let's say it's the pdf viewer mupdf in x11) from the terminal, the application will be launched in a new window but the terminal from which I launched becomes this prompt-less console for that application to log whatever.  I use dmenu to launch applications, but sometimes an application needs arguments (file names) to start. I use uxrvt within x11 managed by dwm. How to add a custom icon or symbol to a flag link? I'm working on a 'sample request' implementation for a commerce site using , , sessions and a little custom code.  I'd like to add an icon or a symbol to let people know that an item they are viewing has been flagged.  I'm not sure exactly how to approach this, I can imagine perhaps adding a conditional field that displays an image or check box that is then changed by  or ajax, or perhaps something more complicated in JavaScript?  It could really be as simple as adding a checkbox that is checked or unchecked as the flag link is clicked or maybe even changing the css/html on click to be identified as marked.   Anyway, grateful for any advice here. I tried to search for similar questions, as I always do, but was not able to find one. I just created a new  on Data.Stack Exchange with my existing Google OpenID and it seems to be not associated with my regular Stack Exchange account. Is this by design? and if so, why? What are best practices for blocking UI when application is busy I'm writing a web app using Twitter Bootstrap with PHP on server side. My app makes regular ajax requests via jQuery and i want to disable certain parts of the UI until the server completes processing and hands back the control to Client-Side.  I wonder what would be best practices for the same? are two consecutive numbers relatively prime? Can I run Ubuntu OS on a Android 4.0 tablet? Users with less than 50 reputation points cannot write comments on questions and answers that they don't own.  Why does this limit exist? But I want to contribute now. What should I do instead? But I can't write a good answer without more information! Shouldn't I be allowed to post comments if I have reputation on a different site? But I saw a new user posting a comment! How did they do it? Why do I need 50 reputation to comment on my own post?   See also:    in the Help Center What is an intuitive explanation of the Expectation Maximization technique? What the pointer size in 64 bits computer in C++? List of all "partitions"/ "cuttings" of a list Scale camera to fit screen size unity My background and gameobjects are 2d sprites not UI images ,I want to know how to make my background scale with screen size and positions of 2d sprits on it don't change after building game (webGl) like scale canvas with screen size and anchor points in UI elements .  Before building the game   After building Ch.3 #7. Prove that the convergence of $\sum a_n$ implies the convergence of $$\sum \frac{\sqrt{a_n}}{n},$$ if $a_n \geq 0$.      My attempt. If $\sum a_n$ is convergent, then by the root test, $\lim_{n \rightarrow \infty} sup \sqrt[n]{|a_n|} &lt; 1$. This means $|a_n|^{1/n} &lt; 1$. Because $a_n \geq 0$, this means $a_n ^{1/n} &lt; 1$. Now apply the root test to $\sum \frac{\sqrt{a_n}}{n}$ by considering $$\lim_{n \to \infty} sup \sqrt[n]{|\frac{\sqrt{a_n}}{n}|}.$$ $$\sqrt[n]{|\frac{\sqrt{a_n}}{n}|} = \frac{\sqrt{{a_n}^{\frac{1}{n}}}}{\sqrt[n]n}.$$ Because  $a_n ^{1/n} &lt; 1$, certainly the numerator on the left-hand side of the equation above is $&lt;1$. And because $n$ tends to $\infty$, and $n &gt; 1 \rightarrow \sqrt[n]n &gt; 1,$ the denominator is $&gt;1$. Therefore the limit is $&lt;1$ and the root test implies that $\sum \frac{\sqrt{a_n}}{n}$ converges.     If there are any errors in my proof, I think they come from 1) my assumption of the converse of the root test theorem and 2) my misunderstanding of $\lim_{n\to\infty} sup$. Thanks in advance for your help. I looked at similar questions and wanted to post a more specific one.  If I wanted one of my accounts on the network to no longer be associated to my global account, could an administrator do it manually? I mean, even if they could, would they?  It's a matter of professionalism. I don't want one of my accounts on the network to be visible from my other accounts. I just want that to be under a separate email that's not one of the OpenIDs associated with my global account.  I realize this would have been easier to do when I joined that site, but it's too late now, and only now have I realized that I don't really want that account showing up.  So can it be done by an administrator? I don't want to wait weeks and weeks for a response by using the contact form (funny, I've waited two with this post)... I want to overlay one image with another using CSS. An example of this is the first image (the background if you like) will be a thumbnail link of a product, with the link opening a lightbox / popup showing a larger version of the image.   On top of this linked image I would like an image of a magnifying glass, to show people that the image can be clicked to enlarge it (apparently this isn't obvious without the magnifying glass). If a blocking creature leaves the battlefield, is the attacker still blocked, or will it damage the opponent? Suppose Player 1 has a Dragon on the table and  in hand, while Player 2 has two Spiders on the table.  Player 1 chooses to attack with the Dragon and Player 2 chooses to block with one of the Spiders.  Before combat damage is to be dealt, Player 1 uses Unsummon on the blocking Spider.    Does Player 2 take any life damage from the attacking Dragon? Verification that $\lim_{x \to a}\frac{f(x)-f(a)}{x-a}$ and $\lim_{h\to 0}\frac{f(a+h) -f(a)}{h}$ are equivalent definitions of the derivative. I wanted to verify that for definition of the derivative it is true that:  $$ \lim_{x \to a}\frac{f(x)-f(a)}{x-a}= \lim_{h\to 0}\frac{f(a+h) -f(a)}{h}$$  If I denote $h=x-a$,  we can  let $x\to a$, this means that $h \to 0$. Also notice that $f(x)=f(a+h)$ $$ \lim_{x \to a}\frac{f(x)-f(a)}{x-a}=\lim_{h \to 0}\frac{f(a+h)-f(a)}{h}$$ As desired. Is the main idea here really just to use a variable substitution? I suppose there is some formal theorem I also use here that when $f(x) \to y$  we can let $g(f(x)) \to g(y)$ if the function $g$ is continuous. Don't exclude results that have punctuation just because the query doesn't The new search function allows quoted queries that include punctuation, and this is fantastic, most of the time. However, the search considers the punctuation as part of the word itself, so searches for "a test" will not show results containing a test,, a test., or a test?. The reverse is also true.  Is this the intended behavior ? &lt;--(space added so that behavior will show in results.)  It seems that the logical way to do fix this (while maintaining character search) is for queries with punctuation to match results with punctuation, while queries without punctuation to match either with and without.    Example:  vs     A more practical example is described in Arjan's answer below. Is the following layout possible with the subfigure package?