Beginner Java question: when I have  Integer i = 6; ArrayList&lt;Integer&gt; ar = ArrayList&lt;Integer&gt;(); ar.add(i);   then I write i = 8, ar.get(0) returns 6.  But if I trie the same thing with a class of mine:  class MyC {     Integer i; } MyC myc = new MyC(); myc.i = 6; ArrayList&lt;MyC&gt; ar = ArrayList&lt;MyC&gt;(); ar.add(myc);   then do myc.i = 8, ar.get(0) returns 8.  Can you please explain this behavior?
I always thought Java uses pass-by-reference. However, I've seen a couple of blog posts (for example, ) that claim that it isn't (the blog post says that Java uses pass-by-value). I don't think I understand the distinction they're making. What is the explanation?
I got this problem from my teacher as a optional challenge. I am open about this being a given problem, however it is not homework. The problem is stated as follows. Assume we have an infinite tetration as follows $$x^{x^{x^{.^{.^.}}}} \, = \, a$$ With a given $a$ find $x$. The next part of the problem was to discuss the convergence radius of a. If a is too big or too small the tetration does not converge. Below is my humble stab at the problem.  My friend said you would have to treat the tetration as a infinite series, and therefore could not perform algebraic manipulations on it before it is know whether it converges or diverges. However my attempt is to first do some algebraic steps, then discuss the convergence radius. I) Initial discussion At the start it is obvious that the tetration converges when $a=1$ (just set $x=1$) Now after some computer hardwork it seems that the tetration fails to converge when a is roughly larger than 3. II) Algebraic manipulation $$ x^{x^{x^{.^{.^.}}}} \, = \, a$$ This is the same as $$ x^a \, = \, a$$ $$ \log_a(x^a) \, = \, \log_a(a)$$ $$ \log_a(x) \, = \, \frac{1}{a}$$ $$ x \, = \, a^{\frac{1}{a}}$$ Now, if we let $a=2$ then $x = \sqrt{2}$. After some more computational work, this seems to be correct, which makes me believe this formula is correct. III) Discsussion about convergence By looking at the derivative of $ \displaystyle \large a^{\frac{1}{a}} $ we see that the maxima occurs when $a=e$, which also seems to correspond to the inital computational work. Now I think, that the minima of $\displaystyle \large a^{1/a}$ is zero by looking at its graph, studying its derivative and the endpoints. So that my &quot;guess&quot; or work shows that it converges when $$ a \in [0 \, , \,  1/e] $$ VI) My questions Can my algebraic manipulations be justified? They seem rather sketchy taking the a`th logarithm and so on . (Although they seem to &quot;magically&quot; give out the right answer) By looking at Wikipedia it seems that the tetration converge when $$ a \in \left[ 1/e \, , \, e \right] $$ This is almost what I have, why is my lower bound wrong? How can  I find the correct lower bound? Genetic linkage greater than 50 centimorgans Classically, the linkage between two loci can be measured in centimorgans (cM), which represents the percent chance that these two loci will recombine an odd number of times (generating a recombinant genotype).  Due to independent assortment, markers on different chromosomes are expected to recombine 50% of the time. As I understand, if one conducts a classic experiment and counts various progeny, then deduces the apparent linkage, values of 50 cM or more are interpreted as "impossible to determine whether on separate chromosomes or just recombines very often". See (), with grammar corrected:     The final point that we need to make regards the maximum distance that we can measure. Because of the way in which the calculations are performed, we can never have more (than) 50% recombinant gametes. Therefore the (maximum) distance that two genes can be apart and still measure that distance is just less (than) 50 cM. If two genes are greater than 50 cM apart, then we can not determine if they reside on the same chromosome or are on different chromosomes.   Wikipedia gives an  and also remarks that (d is physical distance):     The probability of recombination is approximately d/100 for small values of d and approaches 50% as d goes to infinity.   However, what happens if the linkage is greater than 50 cM? It seems like classical experiments aside, such a situation is possible in reality.  For instance, , and . Let's take two genes on Chr.IV:    is at about +631 kb.  is at about +1370 kb.   The physical distance between these is about 734 kb. According to the cM/kbp value, the centimorgan distance is $734\text{ kb} \cdot 0.31\text{ cM}/\text{kb} = 228 \text{ cM}$ . How to interpret this 228?  If I mate a haploid yeast which is DNF2 TOM1 with another which is dnf2 tom1 (lowercase indicating minor allele rather than deletion), then sporulate them, what is the chance of getting spores with DNF2 tom1 or dnf2 TOM1 genotypes?  I realize that the cM/kbp value is only a simplification and that in practice linkage is a more complex phenomenon. Nevertheless, it seems plausible that several crossover events can happen on Chr.IV since it is so big. This includes the possibility of 1, 3, 5 and more crossovers which would create a hybrid (assuming they all happen between these two loci), as well as the possibility of 2, 4, etc crossovers which would create a non-hybrid spore (at least as far as our chosen markers are concerned). How do I concatenate JavaScript files into one file? What does it mean when it says under a journal article that it has been communicated by "XYZ" where XYZ is not the author but some other scholar with a very strong reputation? What is the relationship to the actual author and/or the content? Is this some sort of seal of approval to get results out and known quickly? (I am specifically wondering in the context of mathematics and mathematical physics.) Django: AppRegistryNotReady() Order Bars in ggplot2 bar graph MySQL Insert query doesn't work with WHERE clause My Ubuntu 16.04 keeps disconnecting from the Wi-Fi (eduroam). Why? I found this very amusing comic on the internet the other day:   The last frame seems to claim that the harmonic series converges if you throw out all the terms with a $9$ in the denominator. Is this true? Where could I find a proof? Is it only true for terms with a $9$ or is it true for any number? If it's only true for $9$, why is that? Dual boot Ubuntu (14.04) with Windows 10 Correct user names when tracking /etc/ in git repository and committing as root We use git to track changes in /etc/ on our servers.  Administrators work as root when changing files in /etc/, and thus their commits have author  root &lt;root@machinename&gt;   This is not very satisfying since you cannot see which admin actually did the change.  What can we do to get the real admin names in the git log? I don't think that keeping a local clone of the repository is feasible since we often change interatively until something works, and a change-commit-push-seeError-repeat cycle would not help here. What are tag synonyms? How can tag synonyms be distinguished from "real" tags? How are new tag synonyms created? Who can create tag synonyms? How can I delete/reverse/undo bad tag synonyms? What are merged tags? "Always on top" option missing for Firefox/Chrome in 18.04 When is the move constructor called in the `std::move()` function? How do I syntax check a Bash script without running it? Is it possible to check a bash script syntax without executing it?  Using Perl, I can run perl -c 'script name'. Is there any equivalent command for bash scripts? Can you enter the Schengen area with a UK visa? I noticed that Dolores Umbridge was born during the first Wizarding War, so it's very likely she wasn't a Death Eater then (but she is pretty evil -- who knows?).  After that Voldemort was not around in a way that could affect many people, and most wouldn't know he was planning to rise again.  During that time, and up through Voldemort's return (in Goblet of Fire), did Umbridge have any connection with the Death Eaters or with Voldemort?  Was she doing what she did on her own, or was it because of an association with Voldemort or his allies? Javascript add leading zeroes to date How do I get an RSS feed of my YouTube subscriptions? The default "Subscriptions" feed on the YouTube homepage shows all of the activity of the people that I am subscribed to on YouTube or have in circles on Google+. However, I'm most interested in new videos that the people I subscribe to (either on YouTube or by circling on Google+) create and post (neglecting comments or sharing other people's videos - what you see when you check the "show uploads only" checkbox on the YouTube homepage). However, being able to bring anything off of the YouTube homepage and into Google Reader as an RSS feed would be good.  Is there a way to do this? In the definition of a field one of the required properties is that  every element other than zero has a multiplicative inverse.  It's vague whether the zero is forced not to have an inverse or not, as in is the property  every element other than zero has a multiplicative inverse and zero does not  or  every element other than zero has a multiplicative inverse and zero may or may not?  Regardless, what differences would occur if we adopted one definition as opposed to the other?