Can you compare chars with ==? For Strings you have to use equals to compare them, because == only compares the references.  Does it give the expected result if I compare chars with == ?    I have seen similar questions on stackoverflow, E.g.      However, I haven't seen one that asks about using == on chars.
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?
I know it might be too easy for you guys here. I'm practicing some problems in the textbook, but this one really drove me crazy. From $\gcd( a, b ) = 1$, I have $ax + by = 1$, where should I go from here? The extra $ac$ is so annoying. Any hint?    Thanks, Chan Why on-shell vs. off-shell matters? The definitions between on- and off-shell are given in .   Why is it so important in QFT to distinguish these two notions? How to prove the following expression does not depend on x? I'm not sure how to approach this question, but I know it has something to do with taking the derivative of this. Can anyone please help me out?  Let x > 0. Prove that the value of the following expression does not depend on x: $$\int_{0}^{x}\frac{1}{1+t^4} dt + \frac{1}{3}\int_{0}^\frac{1}{x^3} \frac{1}{1+t^\frac{4}{3}} dt$$ Showing a tensor is not a simple tensor Let $(e_1,e_2)$ be the standard basis of $\mathbb{R}^2$. Why can the element $e_1\otimes e_2 + e_2\otimes e_1$ in $ \mathbb{R}^2\otimes_{\mathbb{R}} \mathbb{R}^2 $ not be written as a simple tensor $v\otimes w$ for $v,w\in \mathbb{R}^2$?  If we suppose $e_1\otimes e_2 + e_2\otimes e_1=v\otimes w$, then can we conclude that $e_1=\lambda e_2$ for some $\lambda \in \mathbb{R}$? This would give a contradiction since $e_1$ and $e_2$ are linearly independent. However, I am not sure if the argument is valid. File issues after importing Drupal site I recently tried to move my Drupal site to a new server using this page: . But now the style doesn't seem be loaded and more importantly I get this error on every page in the site (even on the frontpage):  Warning: file_put_contents(temporary://filef76T9k): failed to open stream: &quot;DrupalTemporaryStreamWrapper::stream_open&quot; call failed in file_unmanaged_save_data() (line 1900 of /Library/Server/Web/Data/Sites/Default/drupal/includes/file.inc). The file could not be created.  Any ideas what this could be about? Automatically add vertical space /only/ between two sequential paragraphs I am using KOMA-script scrreprt class.  I know I can use \usepackage{parskip} or \setlength{\parskip}{12pt}, but both of these also affect headings.  Adding \vspace{12pt} manually between all two sequential paragraphs seems to work, but that's anything but convenient. Is there a way to automate it? equal size numerator and denominator I am trying to size the numerator and denominator of the below equation so that they are equal in size.  I have not had much luck suggestions are appreciated.  \begin{equation} \sum_{i=1}^{n} \frac{\frac{cf_{n}}{(1+i)^n}} {\displaystyle\sum_{i=1}^{n}\frac{cf_n}{(1+i)^n}} , n_{i} \end{equation} Ok, I must be missing something obvious, but I'm having trouble adding a link to user/%/edit to the main menu.  In the Menu UI, I clicked "add link," set the title to "Account settings," and then was at a loss about what to put for the path.  I know how to generate a link to the account edit page using views, which is what I've always done before, but this time I actually need to add the link to the "Main Menu." Given a template where the HTML cannot be modified because of other requirements, how is it possible to display (rearrange) a div above another div when they are not in that order in the HTML? Both divs contain data that varies in height and width.  &lt;div id="wrapper"&gt;     &lt;div id="firstDiv"&gt;         Content to be below in this situation     &lt;/div&gt;     &lt;div id="secondDiv"&gt;         Content to be above in this situation     &lt;/div&gt; &lt;/div&gt; Other elements   Hopefully it is obvious that the desired result is:  Content to be above in this situation Content to be below in this situation Other elements   When the dimensions are fixed it easy to position them where needed, but I need some ideas for when the content is variable. For the sake of this scenario, please just consider the width to be 100% on both.  I am specifically looking for a CSS-only solution (and it will probably have to be met with other solutions if that doesn't pan out).   There are other elements following this. A good suggestion was mentioned given the limited scenario I demonstrated&mdash;given that it might be the best answer, but I am looking to also make sure elements following this aren't impacted. Let $a_n$ be the number of those permutation $\sigma $ on $\{1,2,...,n\}$  such that $\sigma $ is a product of exactly two disjoint cycles. Then find $a_4$ and $a_5$.   Calculating $a_4$: Possible cases which can happen are $(12)(34),(13)(24),(14)(23)$, any cycle of the form $(123)$ or $(12)$ i.e. two-cycles and three cycles thus we have in total $3+\frac{1}{3}4P_3+\frac{1}{2}4P_2=3+8+6=17$ but the correct answer is given to be either $11$ or $14$.  Where am I wrong? Please help. Range of $(a_{1}-a_{2})^2+(a_{2}-a_{3})^2+(a_{3}-a_{4})^2+(a_{4}-a_{1})^2$ is If $a_{1},a_{2},a_{3},a_{4}\in \mathbb{R}$ and $a_{1}+a_{2}+a_{3}+a_{4}=0$ and $a^2_{1}+a^2_{2}+a^2_{3}+a^2_{4}=1.$ Then Range of $$E =(a_{1}-a_{2})^2+(a_{2}-a_{3})^2+(a_{3}-a_{4})^2+(a_{4}-a_{1})^2$$ is  Try: From $$(a_{1}-a_{2})^2+(a_{2}-a_{3})^2+(a_{3}-a_{4})^2+(a_{4}-a_{1})^2$$ $$=2(a^2_{1}+a^2_{2}+a^2_{3}+a^2_{4})+2(a_{1}a_{2}+a_{2}a_{3}+a_{3}a_{4}+a_{4}a_{1})$$ $$=2-2(a_{1}+a_{3})(a_{2}+a_{4})=2+2(a_{1}+a_{3})^2\geq 2$$ and equality hold when $\displaystyle a_{1}=-a_{3}$ and $a_{2}=-a_{4}$ Could some help me how to find its upper bound, Thanks What was the point of the stormtroopers' armour? It seems that it didn't actually protect them from any form of attack.   Every direct hit from a laser seemed to kill a stormtrooper outright, and a slice from a lightsaber cuts straight through. For some results returned in Google Search, on the right side it displays the company details, logo, contact numbers, etc...   For example, see the following screenshot:    I'd like to know what contributes to this so that I can try to achieve it for my site too. What's the weight of the earth? What's the weight of the earth?  That is, what's the weight of the earth in the gravitational field of the sun? I imagine it's either   $0$, because there's no net fall toward the sun, so the downward component of acceleration is $0$ and $F=ma=0$, or $Gm_1m_2/r^2\approx7\cdot10^{-11}\cdot6\cdot10^{24}\cdot2\cdot10^{30}/(1.5\cdot10^{11})^2\approx4\cdot10^{22}$ Newtons,   but which, and why? What is the word for act of monotonously demanding for something (many be a toy) repeatedly? Update all objects in a collection using LINQ Is there a way to do the following using LINQ?  foreach (var c in collection) {     c.PropertyToSet = value; }   To clarify, I want to iterate through each object in a collection and then update a property on each object.  My use case is I have a bunch of comments on a blog post, and I want to iterate through each comment on a blog post and set the datetime on the blog post to be +10 hours. I could do it in SQL, but I want to keep it in the business layer. As a native speaker of English, the gerund version of this sentence sounds better:  infinitive:     When used together in chains,   extension methods are an unprecedented   tool to produce extremely concise   code.   gerund:     When used together in chains,   extension methods are an unprecedented   tool for producing extremely concise   code.   But how can I explain to someone learning English how to decide in situations like these whether to use the infinitive or the gerund? Printing all instances of a class tl;dr  Due to the special nature of Meta and the high rate of "lost souls", should we try out the Ask a Question Wizard here on Meta Stack Exchange too?  General idea  In case anyone doesn't know yet, . It guides new users towards writing better questions.  I think that such a question wizard would be useful on Meta Stack Exchange too, for three main reasons:   . There are four types of questions on Meta, each represented by the different required tags: , ,  and . Especially bug reports can often be split into a certain structure (what's wrong, how to reproduce, why I think it's wrong, examples). The same holds true for feature requests. Such a structure is ideal for a question wizard. Quite a few users  and . While the Meta community is well prepared to deal with these posts quickly, they lead to an less-than-ideal first impression by the new users and they distract the community from more important issues. Site-specific questions are often off-topic. This  since nowhere is it hinted at in the help pages (and there are a lot of old, not-yet-closed SO-specific questions from a prior era of this site) and can lead to unnecessary drama. If we add an honeypot into the wizard to catch this case (and ideally redirect them to the proper meta site), we could prevent this.   As Sonic said, there's an  new users need to read and confirm. However this doesn't really prove effective right now and we might need to try stronger tools (e.g. question wizard).  Therefore I think that we should test the Ask Question Wizard here on Meta too.  Implementation details (help welcome)  I think the wizard should have six main entry points:   I want to discuss a specific post or action from any Stack Exchange site. (-> honeypot, redirects to the appropriate per-site meta) I have a question regarding the use of Stack Exchange sites (-> support mode) I think I found a bug while using the Stack Exchange sites  (-> bug mode) I have an idea for improving the Stack Exchange sites  (-> feature request mode) I have a discussion I want to start about Stack Exchange communities or their rules  (-> discussion mode) I have some other (e.g. programming) question  (-> honeypot, redirects to )   Coming from these choices, the user would either be redirected to a landing page explaining, why this is not the right community and offering some alternative choices or they would follow the guided assistant.  For 1. the user might be asked on which site the post/action is. Maybe the system could show the three sites where the user was recently active/has the highest reputation on.  support mode would ask the user for these details:   what do you want to achieve? what have you tried? what is your current problem?   bug mode would ask the user for these details:   bug description how to reproduce the problem why do you think that this is wrong? (possibly) examples   feature request mode would ask the user for these details:   what is your goal? how do you think could this be achieved? why will the community benefit from this change? (possibly) details   discussion mode would ask the user for these details:   which rule do you want to propose/clarify (optionally) examples/why is this rule required?   Note: the above implementation details probably require some revision. Feel free to edit/suggest improvements for both wording and details. Why must a final variable be initialized before constructor completes?