I run the following code and get the results shown in the comments. I know the differences between == and .equals(). What I don't understand is why my code in the second line has different results from the code in the third line.       String de = "de"; //  String abcde = "abc" + "de"; // abcde == "abcde" reture true     String abcde = "abc" + de;   // abcde == "abcde" reture false;     System.out.println();     System.out.println(abcde=="abcde");     System.out.println(de=="de");   In trying to debug this I used the javap -c command and got the following output 'code' for the first string concatenation:           Code:  0:   ldc     #9; //String de  2:   astore_1  3:   new     #10; //class java/lang/StringBuilder  6:   dup  7:   invokespecial   #11; //Method java/lang/StringBuilder."&lt;init&gt;":()V  10:  ldc     #4; //String abc  12:  invokevirtual   #12; //Method java/lang/StringBuilder.append:(Ljava/lang  String;)Ljava/lang/StringBuilder;  15:  aload_1  16:  invokevirtual   #12; //Method java/lang/StringBuilder.append:(Ljava/lang  String;)Ljava/lang/StringBuilder;    19:  invokevirtual   #13; //Method java/lang/StringBuilder.toString:()Ljava/l  ng/String;    22:  astore_2    23:  getstatic       #14; //Field java/lang/System.out:Ljava/io/PrintStream;    26:  invokevirtual   #15; //Method java/io/PrintStream.println:()V    29:  getstatic       #14; //Field java/lang/System.out:Ljava/io/PrintStream;    32:  aload_2    33:  ldc     #16; //String abcde    35:  if_acmpne       42    38:  iconst_1    39:  goto    43    42:  iconst_0    43:  invokevirtual   #17; //Method java/io/PrintStream.println:(Z)V    46:  getstatic       #14; //Field java/lang/System.out:Ljava/io/PrintStream;    49:  aload_1    50:  ldc     #9; //String de    52:  if_acmpne       59    55:  iconst_1    56:  goto    60    59:  iconst_0    60:  invokevirtual   #17; //Method java/io/PrintStream.println:(Z)V    63:  return   And the output for the second string concatenation:    I am not so familiar with this 'code' and can't see any reason why these differences exists. So could anyone explain why those differences happen?  Related
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?
Is there a tool to get the lines in one file that are not in another? Can TikZ create pixel art images? Can you create images like this:    when you have something like  0 = green (#54ff00) 1 = white (#ffffff) 2 = red   (#ff0000) 3 = blue  (#0048ff)  Image (Python list of integers defined above): [[2,0,0,0,0,0,0],  [0,3,0,0,0,0,0],  [0,3,2,1,1,0,0],  [0,3,2,2,2,1,1],  [0,3,2,0,0,1,0],  [0,0,0,0,0,1,0],  [0,0,0,0,0,1,0]]   with TikZ?  How far I got  The following MWE defines all colors, produces a grid of the correct size (though the size is determined by hand):  \documentclass[varwidth=true, border=2pt]{standalone} \usepackage{tikz} \usepackage{xcolor}  \begin{document}     \newcommand\n{7}     \definecolor{green}{HTML}{54FF00}     \definecolor{wite}{HTML}{FFFFFF}     \definecolor{red}{HTML}{FF0000}     \definecolor{blue}{HTML}{0048FF}     \begin{tikzpicture}         \foreach \x in {1,...,\n}{             \foreach \y in {1,...,\n}{                 \begin{scope}[shift={(\x,\y)}]                   \draw [fill=green] (0,0) rectangle (1,1);                 \end{scope}             }         }     \end{tikzpicture} \end{document}   Of course, I could simpy make a lot of adjusted                   \begin{scope}[shift={(\x,\y)}]                   \draw [fill=green] (0,0) rectangle (1,1);                 \end{scope}   but I've wondered if this can (with reasonable effort) be done in TikZ / LaTeX.  My problem is giving TikZ the color array. I don't have any idea how to do this. I only know two types of looks in TikZ:  \foreach \x in {0,1,2,3,4,5}{...} \foreach \number in {1,...,\n}{...}   I have never seen a nested over a 2D-array. All I have seen so far were 1D-Arrays of tuples (with fixed tuple size). If $a,b,c$ are positive , show that $$\dfrac{b^2+c^2}{b+c}+\dfrac{c^2+a^2}{c+a}+\dfrac{a^2+b^2}{a+b} \ge a+b+c$$  Trial: Here  I proceed in this way $$\dfrac{b^2+c^2}{b+c}+\dfrac{c^2+a^2}{c+a}+\dfrac{a^2+b^2}{a+b} \ge  \dfrac{2bc}{b+c}+\dfrac{2ca}{c+a}+\dfrac{2ab}{a+b}$$ then how I proceed. Please help. Summoning an item in 1.9 with motion When I put   /summon Item ~ ~2 ~ {Item:{id:"minecraft:diamond",Count:1b,Motion:[0.0,0.8,0.0]}}    in a command block, it summons the diamond with Count:1b but it doesn't follow the Motion Tag. Does anyone know how to get the Motion Tag working? How can I run Debian stable but install some packages from testing? Say you're running a server and you don't want to upgrade to Testing (Squeeze) from Stable (Lenny) to just install a required package or two.  What's the best way of installing only certain packages from Testing? Where do I find the maximum node? A lot of people recommend to use the maximum node for glass setup, but I can't find that node. Nothing comes up when I search for it.  Where do I find it? I'm fitting a regression on the $\log(y)$.  Is it valid to back transform point estimates (and confidence/prediction intervals) by exponentiation?  I don't believe so, since $E[f(X)] \ne f(E[X])$ but wanted other's opinions.  My example below shows conflicts with back transforming (.239 vs .219).  set.seed(123)  a=-5 b=2  x=runif(100,0,1) y=exp(a*x+b+rnorm(100,0,.2)) # plot(x,y)  ### NLS Fit f &lt;- function(x,a,b) {exp(a*x+b)}  fit &lt;- nls(y ~ exp(a*x+b),  start = c(a=-10, b=15))  co=coef(fit) # curve(f(x=x, a=co[1], b=co[2]), add = TRUE,col=2,lwd=1.2)  predict(fit,newdata=data.frame(x=.7)) [1] 0.2393773  ### LM Fit # plot(x,log(y)) # abline(lm(log(y)~x),col=2) fit=lm(log(y)~x) temp=predict(fit,newdata=data.frame(x=.7),interval='prediction') exp(temp)         fit       lwr       upr 1 0.2199471 0.1492762 0.3240752 I was watching some videos on YouTube showing how to get the Duke O' Death in GTA 5, however what I have seen is sort of unclear.  Some people say you must be a returning player on GTA 5 to get it (what does this mean too BTW?), some people don't say that. Some people say you have to be Trevor, some people don't. Some say the time of day matters, some don't. And apparently you can buy it from Warstock website (I can't).   Can someone please tell me how to get it?! GTA 5 came with my PS4 (I didn't play it on PS3) if that helps. What determines the number of comments that are displayed? Java version problem with Eclipse and NetBeans on 18.04 How do I change NEI to cheat mode? How can I tell whether beetroot is still edible? I have some raw beetroot I bought about a week ago, having stored them at room temperature since. It's the first time I bought it raw, and I'm unsure whether it's still edible.   It is already soft, and when I cut it, it smells... Well, different than I expected. It's not a rotten smell as such, but it's nothing like the sweet beet-rooty smell I know from the pre-packaged, pre-boiled supermarket variety.  How can I tell whether it's still safe to eat? Where and how does the Bleach anime diverge from the manga? I've seen almost all of the Bleach anime (at least what's been released dubbed), and I'm now interested in reading the manga. However, when the manga closely follows the anime I've already seen, I tend to get bored quickly. Thus, I'd want to pick up the manga at a point right before the anime began to diverge.  At what point in the manga is this? Override a single JavaScript file from a module When I went to the review overview on Meta on 08.01.2015, 19:16, it listed two open items in the suggested-edits queue, however when I clicked on the queue, I was told that the queue had been cleared. When I went back to the review overview, however, the edits were there again.  Since the icons for recent reviews had not moved, I suppose that these were still the same two items waiting for review, and since phenomenon lasted for half an hour now, I would rule out  or  to be the reason for this.  After a while, the phenomenon ceased, with one new reviewer popping up in the icon list of recent reviewers.  I had not performed or skipped any suggested-edit review from the queue at that point.    A similar phenomenon occurred for several hours up to 11.04.2015, 11:05: The review overview showed two suggested edits and when I went to the suggested-edits queue, it was cleared. Sometimes, edits that I could review appeared, but two phantom edits remained. Word for obscuring bad or immoral acts with verbiage I have been in many scenarios where people try to obscure/reduce the intensity of a seemingly bad or immoral act using grammar. E.g. Assuming Thomas killed a dog, you could hear something like:     There's essentially nothing wrong about palliating the miserable life   of a despondent being. If there was any issue here, I'd say it's not   consulting a veterinary doctor first but I've come to understand that some people are just straightforward.   How does one react to the above mumbo jumbo? I think there are similar situations also found in law courts. What can this be referred to as? Grammatification, obscure tactics? If two ends were a certain "length" apart were they therefore at rest (or at least rigid) to each other? I'm taking an electronic circuit analysis class, and I was asked to give the color of the 3rd band of a 1MΩ resistor. My answer was blue, thinking it could be black-brown-blue (01 * 1MΩ), but the automated quiz said the correct answer was green (brown-black-green).  So I did some research, thinking there were just multiple correct answers, and I read in a few places that the first band on a resistor is never black (0). Why is this? Does a black first band have some other meaning? It would really help me remember it if I knew the history or reasoning behind it.  This question has been answered. For further reading on zero-ohm resistors mentioned in the answers and comments here, I found these questions and answers helpful: Fixed point of a Function (monotonically increasing) Given a DateTime representing a person's birthday, how do I calculate their age in years?