I am learning Java basic concept recently, when I tried some code samples about String.intern there was a weird thing happened. Code below:  Snippet 1(normal):  String str1 = new String("0") + new String("0"); str1.intern(); String str2 = "00"; assertTrue(str1 == str2); // pass assertTrue(str1.equals(str2)); // pass   Snippet 2(weird):  String str1 = new String("1") + new String("1"); str1.intern(); String str2 = "11"; assertTrue(str1 == str2); // fail; what happened??? assertTrue(str1.equals(str2)); // pass   Snippet 3(normal):  String str1 = new String("2") + new String("2"); str1.intern(); String str2 = "22"; assertTrue(str1 == str2); // pass assertTrue(str1.equals(str2)); // pass   So, I don't understand what happened about new String("1"), it's really really confused, I need your help, Thanks a lot!
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?
What do icons on the tags mean? What does an icon on the tag mean, for example the "rg" before the sql-server tag as pictured below? literally as a hyperbole Possible Duplicate:          I have seen a lot of backlash in internet media against people using the word literally to mean something not literal. Something like "he was literally as big as a house" to mean someone was very big I think this comic sums up the anti literal movement well   Is this actually grammatically incorrect or can the word "literally" be a hyperbole strengthening a metaphor? My father wrote some papers on cosmology that remained unpublished at the time of his death.  I have been looking for a publisher for them. I contacted IOP publishing but they said that, while Dad’s writings were interesting, they were not ready for publishing in any of their journals. For example, they need a reference list citing other current published research on the same topic.  I am not a scientist and have no idea how to do this. Where can I get help with this? Would something like  be a good idea? I have a valid (multiple entry) business visit visa to the UK on my old passport. I have recently obtained a new passport as I ran out of pages on my old passport. The purpose of my visit is still for business and there are no change in personal details on my new passport. There is however a change in address on the new passport. Incidentally it is the same address that I filled out for my UK visa application while answering the query "WHAT IS YOUR PERMANENT RESIDENTIAL ADDRESS AND CONTACT DETAILS?"  In light of the above, can I still travel to the UK by carrying both the old and new passports? Or, will I be required to either transfer the visa or make a fresh application for my new passport. Thanks. Hotspot and Internet access together — why not? If I try to set up a hotspot in GNOME, I get the following message:  If you have a connection to the Internet other than wireless, you can use it to share your internet connection with others. Switching on the wireless hotspot will disconnect you from &lt;network name&gt;. It is not possible to access the internet through your wireless while the hotspot is active.  What are the technical reasons why I can't set up an Hotspot and be connected to the Internet at the same time? Why are we still using CPUs instead of GPUs? It seems to me that these days lots of calculations are done on the GPU. Obviously graphics are done there, but using CUDA and the like, AI, hashing algorithms (think bitcoins) and others are also done on the GPU. Why can't we just get rid of the CPU and use the GPU on its own? What makes the GPU so much faster than the CPU? How to download and use any other kernel than the one which is installed by default Last time I asked a similar question but that was about svn related versioning info. Now I am wondering how to query windows "File version" attribute about eg. a dll. I payed attention to wmi and win32file modules as well without success. Hide and seek game $A$ and $B$ go to the Senate to play a game of Hide-and-Seek. There are $100$ rooms in the Senate, and $B$ picks one of them and hides there till the game ends.  $A$, at the beginning of every turn, picks one room and searches in it. Since he is human and thus fallible, he only has a $60\%$ chance of finding $B$ if she is in fact hiding in the room. If he fails to find her in the room, $B$'s score increases by one, and the next turn starts, whereupon $A$ must pick another room to check (he can also check the same room again). $B$ remains in the room she initially chose.  Given that $A$ and $B$ play with perfect strategies, what is the expected value of $B$'s score at the end of the game?  I tried with $1$ room. There is only one hiding place for $B$. So the expected score of $$B = \sum_{n=1}^{\infty}0.4^{n-1}0.6(n-1)=\frac{2}{3}.$$ Given matrices $A$ and $B$, where that $AB = A + B$, prove $AB = BA$. I keep coming up with AB = AB. It seems like basic algebra, but for the life of me, I'm getting nowhere :/. Someone help please? What does "preceding" mean in Oracle? Medium with refractive index less than unity? What are the basics of commands in Minecraft Java Edition? What are the basics of Minecraft commands? If I were to start from scratch, with no knowledge on the topic, what are some things that I need to know? In either case, one coin flip resulted in a head and the other resulted in a tail. Why is {H,T} a different outcome than {T,H}? Is this simply how we've defined an "outcome" in probability?   My main problem with {H,T} being a different outcome than {T,H} is that we apply binomial coefficients (i.e. we count subsets of sets) in some common probability problems. But if we take {H,T} and {T,H} to be different outcomes, then our "sets" are ordered, but sets are by definition unordered...   I feel as though the fact that I'm confused about something so basic means that I am missing something fundamental. Any help or insight whatsoever is greatly appreciated! With powershell get exactly the same application list as in Add/Remove programms There are various methods to find installed applications on the system but to my knowledge none returns exactly the same list as control panel item Add Remove Programs. Some of the ways I tried are:   WMI via Win32_Product and Win32Reg_AddRemovePrograms Registry, both x32 and x64 branches   For instance, I have 217 entries in AR and   gwmi  Win32_Product   returns 261 items.  gp HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*, HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | ? {![string]::IsNullOrWhiteSpace($_.DisplayName) } | select DisplayName   returns 119 items.   (gwmi Win32Reg_AddRemovePrograms) + (gwmi Win32Reg_AddRemovePrograms64) | sort DisplayName -Unique    returns 107 items.  I tried to nail it down with more complex filter that included InstallLocation, InstallSource, InstallDate etc without success. Axiom of Choice: Family of non-empty sets mutually disjoint or not? When to use self references or composition? Is there an equivalent of computation of physical processes in nature? I was watching a waterfall in the Austrian Alps. There were thousands of water droplets falling down, splattering on the stones below. I thought - how does nature find out so quickly where each droplet of water should go? To find out what happens to a falling droplet of water, one can use the laws of motion and calculate the trajectory. To calculate, one needs some amount of time, some machine (the brain, computer) and some energy to feed the machine. Does it make sense to ask what is the equivalent of this computation in nature? How does nature find out so quickly how things should move? More generally, to find out how anything should happen? Where is the &quot;calculation&quot; in nature? There's no room or energy for a machine in the particles that make up things. How Do I Allow A Standard User to Install Programs? How to reset the Xorg / xserver? Xserver keeps crashing on my general user account both in Unity 3D and 2D. It doesn't do it on the guest account.  That's why I want to reset / rollback everything xserver related, hoping this is going to fix it.  Most answers on this involve sudo dpkg-reconfigure xserver-xorg. However, this does nothing for me (generates no output) and I read in other forums, that it's deprecated.  So, what's the current way to reset all xserver / xorg options; what's the alternative to sudo dpkg-reconfigure xserver-xorg? X crashes during work, not before login or so. And the effect of a crash is, that I get thrown out of the session, not a freeze or machine crash.