If else in JSP (switch case) making a website in JSP on eclipse:  select[i] is acquired from the previous webpage correctly as a string from 1 to 5  each number represents a subject ie: if select[i]==1 so sub=Maths   I can not switch case on a string so I tried if else .. but sub is always equal to null (the declaration) ?? how can i make sub take the values in the if condition??    for (int i = 0; i &lt; select.length; i++)          {                 ////             String sub=null;             if(select[i]=="1") {sub="Maths";}             else if (select[i]=="2") {sub="English";}             else if (select[i]=="3") {sub="Physics";}             else if (select[i]=="4") {sub="MI";}             else if (select[i]=="5") {sub="Software";}             ////              rs=stmt.executeQuery("SELECT * FROM attends where userid= '"+user_id+"' and cid= '"+select[i]+"'  ");                if(rs.next())//can not take it                 {                 out.println("You can not enroll in '"+sub+"' ");                 }             else//can take it                 {                 int countUpdated =stmt.executeUpdate("INSERT INTO enroll (userid, cid) values ('"+user_id+"', '"+select[i]+"')");                 out.println("Successfully enrolled in '"+sub+"' ");                 }            }
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?
Minecraft extra folders? Once I click to run minecraft a small window appears saying "Downloading runtime", then three other folders appear onto my desktop: Game, Native Log, and Runtime. This really annoys me, as I have to keep deleting them after I am done with a session of minecraft. Why is this? It never use to happen before. I just rememebered a case when I was still in school: we had to write an essay about a specific topic and one guy put big parts of his essay on Wikipedia before handing it in. When the teacher checked for plagiarism she indeed found big parts of his text in the Wikipedia article and thus accused him of plagiarism.  How would that situation be with journal papers (or other "official" ways of publishing)?  Can I reuse part(s) of texts I wrote myself but that are available publicly/online like on Wikipedia, my Blog, university homepage, etc.?  (Maybe consider that pseudonyms are used on Wikipedia, Blogs, etc.) How do I calculate the determinant of the following $n\times n$ matrices  $$\begin {bmatrix} 0 &amp; 1 &amp; \ldots &amp; 1 \\ 1 &amp; 0 &amp; \ldots &amp; 1 \\ \vdots &amp; \vdots &amp; \ddots &amp; \vdots \\ 1 &amp; 1 &amp; ... &amp; 0 \end {bmatrix}$$  and the same matrix but one of columns replaced only with $1$s?  In the  above matrix all off-diagonal elements are $1$ and diagonal elements are $0$. I have recently created a logo. I have seen an online trend of showing off a logo in a realistic environment, illustrating possible use cases of the logo.  An example of this can be seen here, with the original logo at the bottom and a 3D mockup at the top:    How can I create such a mockup? "Give him a box that everyone knows what it contains." "Give him a box that everyone knows what it contains."  Is this correct English? It sounds wrong to me. My Minecraft app now only has the option of "play" and there is no "play on realms" to be found!  I downloaded - and paid for - the multiplayer app, but there doesn't seem to be a way to get to any realms on that app either. Why don't my female dwellers give birth to children? I am playing Fallout Shelter on my IPad. There were some women who have already gave birth, but two female dwellers are carrying their babies for about 18(!) hours. I know that this process takes three hours, so this is not normal. What do I do? Manifold that is NOT smooth Could someone provide an example of a manifold that is not smooth? All manifolds that come to mind are smooth! By a manifold, I mean a hausdorff, second countable locally euclidean space. Can I disable GNOME legacy tray in 17.04? Is there an exact command for restarting GNOME Shell in Ubuntu 20.04 corresponding to Alt + F2 + 'r' + Enter? Is there a way to restart GNOME Shell other than by using Alt + F2, R + Enter? With respect to the question, I have gone through , but I didn't get what I was looking for. I am looking for a command which exactly does what Alt + F2, r + Enter do. Please note that I am not willing to do the gnome-shell -- replace command... I did check both the things Alt + F2,r Enter and gnome-shell --replace... There is a lot of difference, I found... In a certain case, the user will be asked to confirm if he/she wishes to leave the page, due to editing a post, even when he/she has stopped editing.  To reproduce:   Start editing a post (I've only experienced this with a question) Another user finishes editing the post before you and the message "This post has been edited" appears Clicking on the message bar will take you out of editing mode and will show you the updated post from the other user's edits Trying to navigate away from the page will then ask for your confirmation Do citizens migrate closer to their workplace within the town? By using the Path tool (F2, 7) I have found some laborers walking very long to eat at home or to warm up in winter.  If I build a house close to a Quarry or a Mine, will Stonecutters or Miners move automatically to this house to avoid long walking distances between the workplace and home?  Or can I assign some citizens to houses closer to their workplace? I've seen Breaking Bad complete series 2-3 times, but I never found out how Walter White was able to poison Brock.  I mean did he himself directly feed the Valley of the Lilly berries to Brock or did he let Saul do the work? I can't figure it out. Force "low power mode" on mac Greatest common divisor of two positive integers I know that Greatest common divisor of two positive integers $a$ and $b$ is the largest positive integer that divides both $a$ and $b$, but how can I use that to prove that $\gcd(a, b) = \gcd(a, b-a)$. Bias of maximum likelihood estimators for logistic regression How does $ \sum_{p<x} p^{-s} $ grow asymptotically for $ \text{Re}(s) < 1 $? Level 10 vim adventures beers on the wall complete solution I saw this question  but it doesn't have a full solution. What is the full solution to the 99 bottles of beer on the wall for Vim adventures?  Context: for the sake of being a good SO member I will give more details but a full solution will answer my question. It seems from reading the other post that my register is incorrect for some reason. I can't get the &lt;NL&gt;. I think that's the issue since pasting won't work... There is no "helpful flags" counter (with a link to ) on the mobile version of profile page. And I see no other way to reach flagging summary page and check your flagging history from mobile rather than switching to the full site view.  Desktop version   &nbsp; Mobile version Show $\operatorname{Aut}(C_2 \times C_2)$ is isomorphic to $S_3=D_6$