Why does my array not update after passed in a method that changes its elements? I thought arrays are passed by reference - so when I pass str into replaceSpaces, the method returns 'Mr%20John%20Smith' as a char array which is right, but when it returns back to the main method, the char array goes back to its original value of "Mr John Smith    ".  public static char[] replaceSpaces(char[] s, int n) {         String result = "";          for(int i=0; i&lt;n; i++) {             if(s[i]==' ') {                 result+="%20";             }             else {                 result+=s[i];             }         }          s=result.toCharArray();           return s;     }      public static int findLastCharacter(char[] str) {         for (int i = str.length - 1; i &gt;= 0; i--) {             if (str[i] != ' ') {                 return i;             }         }         return -1;     }       public static void main(String[] args) {          String str = "Mr John Smith    ";         char[] arr = str.toCharArray();         int trueLength = findLastCharacter(arr) + 1;         replaceSpaces(arr, trueLength);          System.out.println("\"" + AssortedMethods.charArrayToString(arr) + "\"");       }
Is Java "pass-by-reference" or "pass-by-value"? 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?
The whole multi-continent aspect of A Song of Ice and Fire seems to be getting out of hand. Do the other continents suffer those long winters?  Can the Others harm the other continents?  In The Lord of the Rings there were other realms than Middle-earth, but Middle-earth was still all of humanity and dwarf population and hobbits.  Sure there are stories like Romeo and Juliet where the only thing that matters is whether those 2 are going have a chance to love.  But in these fantasy / sci-fi stories there's usually danger of world domination by evil.  It's not usually just one continent is going to be a terrible (or impossible) place to live but other civilizations will flourish. The script I use is actually returning this output:  (source /Thetra/Commun/env_ora.sh &gt;/dev/null; sh aclenv/arun)  geIlgif0t1 -DVORACLE geIlgif0t1 prg_25900: ACOMP=X geAhadlAd1 -DVORACLE geAhadlAd1 prg_25948: ACOMP=A syCcgge0t1 -DVORACLE syCcgge0t1 prg_26023: ACOMP=S2 syVcalq0t1 -DVORACLE syVcalq0t1 prg_26071: ACOMP=Y syVvali0t1 -DVORACLE syVvali0t1 prg_26119: ACOMP=Y syAedit0t1 -DVORACLE syAedit0t1 prg_26167: (1312) DBMS WARNING: Column not found in table. (-11238)   RETURN (-6)     END  END     END     IF cm_para_f2('VDEF','abQtip_0n1','unicite',syAedit0t1:$v_unicite)&lt;&gt;0      OR null_convert$(syAedit0t1:$v_unicite,'R') &lt;&gt; 'F' THEN SET syAedit0t1:$v_unicite TO 'R'     SET $v_tips_mrgl TO 'S'     SET $v_rfbt_iban, $v_rfbt_intitule, $v_orga_creancier, $v_orga_tip_adr1, $v_orga_tip_adr2,         $v_orga_tip_adr3, $v_code_docu, $v_tips_centre, $v_code_etab, $v_orga_tip_emetteur,  $v_orga_emetteur, $v_rfbt_compte, $v_orga_banque, $v_rfbt_emetteur TO     SELECT rfbt_iban, rfbt_intitule, orga_creancier, orga_tip_adr1, orga_tip_adr2, orga_tip_adr3 ACOMP=N syAvali0t1 -DVORACLE syAvali0t1 prg_26215: (2751) DBMS WARNING: Column not found in table. (-11238)  + to_string_using$(str_to_val$(substr$(clip_str$(to_string$($f_imme_no)),1,4)),'&amp;&amp;&amp;&amp;')         + to_string_using$(str_to_val$(substr$(clip_str$(to_string$($f_sepa_propriete_no)),1,5)),'&amp;&amp;&amp;&amp;&amp;')     IF syAvali0t1:$v_unicite ='R' THEN  SET $v_sepa_rum3 TO $v_sepa_rum3 + substr$(to_string_using$(syAvali0t1:$v_ordr_direct,'&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;'),7,9)     ELSE ACOMP=N syAcalc0t1 -DVORACLE syAcalc0t1 prg_26263: ACOMP=N syAcalc0t2 -DVORACLE syAcalc0t2 prg_26311: ACOMP=N syAcalc0t3 -DVORACLE syAcalc0t3 prg_26359: ACOMP=N   To check for errors I use the following command:  (source env_ora.sh &gt;/dev/null; sh aclenv/arun) | egrep '^ACOMP=$'   Output:  (1312) DBMS WARNING: Column not found in table. (-11238)   RETURN (-6)     END  END     END     IF cm_para_f2('VDEF','abQtip_0n1','unicite',syAedit0t1:$v_unicite)&lt;&gt;0      OR null_convert$(syAedit0t1:$v_unicite,'R') &lt;&gt; 'F' THEN SET syAedit0t1:$v_unicite TO 'R'     SET $v_tips_mrgl TO 'S'     SET $v_rfbt_iban, $v_rfbt_intitule, $v_orga_creancier, $v_orga_tip_adr1, $v_orga_tip_adr2,         $v_orga_tip_adr3, $v_code_docu, $v_tips_centre, $v_code_etab, $v_orga_tip_emetteur,  $v_orga_emetteur, $v_rfbt_compte, $v_orga_banque, $v_rfbt_emetteur TO     SELECT rfbt_iban, rfbt_intitule, orga_creancier, orga_tip_adr1, orga_tip_adr2, orga_tip_adr3 (2751) DBMS WARNING: Column not found in table. (-11238)  + to_string_using$(str_to_val$(substr$(clip_str$(to_string$($f_imme_no)),1,4)),'&amp;&amp;&amp;&amp;')         + to_string_using$(str_to_val$(substr$(clip_str$(to_string$($f_sepa_propriete_no)),1,5)),'&amp;&amp;&amp;&amp;&amp;')     IF syAvali0t1:$v_unicite ='R' THEN  SET $v_sepa_rum3 TO $v_sepa_rum3 + substr$(to_string_using$(syAvali0t1:$v_ordr_direct,'&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;'),7,9)     ELSE   We can see that grep is returning non matching lines.  When I redirect the stderr to stdout with this command:  (source /Thetra/Commun/env_ora.sh &gt;/dev/null; sh /Thetra/Oracle/transfert/P2016.H.1/aclenv/arun) 2&gt;&amp;1 | egrep '^ACOMP=$'   As expected, the output is void.  Why grep is returning non matching lines when stderr is not redirected ? How do you do a deep copy of an object in .NET? Occasionally, I've come across a webpage that tries to pop open a new window (for user input, or something important), but the popup blocker prevents this from happening.  What methods can the calling window use to make sure the new window launched properly? How do I turn on SharePoint App store in SharePoint 2013 I just bought a SATA SSD, and wish to install Windows 7 directly on it, but when Windows asks me where do I want to install it, it doesn't recognize any drives.   I have disconnected all my other HDDs My BIOS recognizes the SSD. I went back to my original installation of Windows and my SSD is recognized Is using only HTTPS bad in a SEO perspective? I would like to set up a new business site. I plan to direct www.example.com to example.com and only use that domain. My plan is also to only use HTTPS and not HTTP.   Does this affect the SEO for the site? E.g. do Google put lower or higher rank for sites that is only available via HTTPS? In previous Ubuntus (GNOME, not unity) I could add "--incognito" to the end of the executable file command of Chrome to make Incognito default.  I cannot find an executable file for Chrome in 12.04. How do I make Incognito default for Chrome in 12.04? Expressing using properties of vectors It is given in question that $x+a=(a.x)b$ and it is stated that a,b and x are vectors.It is also stated that $a.b$ not equal to $1$.The question ask to express $x$ in term $a$ and $b$,how do you this? Quantum entanglement: does it necessarily imply superluminal information transfer? Device that makes metal malleable When may adjectives precede determiners? (E.g. too difficult a task) The expression too difficult a task sounds a little pompous, but it doesn't sound ungrammatical. According to my folk-beliefs about English grammar, determiners precede adjectives. However, the expression too difficult a task seems to controvert that belief.  Additionally, the expression too difficult of a task seems grammatical too.    Under what conditions may determiners precede adjectives? Are there conditions under which too difficult of a task would be a more grammatical expression than too difficult a task would be?   (This question does not ask what the question “How big of a problem” vs. “how big a problem” asks. That question does not pertain to determiners.) Show that if $f:X\to Y$ is a continuous function if and only if the graph of $f$ is a closed subset of $X\times Y$ I learned that the force from a magnetic field does no work. However I was wondering how magnets can be used to pick up pieces of metal like small paperclips and stuff. I also was wondering how magnets can stick to pieces of metal like a refrigerator? Finding the shortest distance between two lines I know how to find the distance between a point and a line, not between two lines.  Find the shortest distance between the lines $(-1,1,4) + t(1,1,-1)$ and $(5,3,-3) + s(-2,0,1)$  Any help would be appreciated. Having some trouble proving this:     If $f:\mathbb{R}\rightarrow \mathbb{R}$ is differentiable and $\lim_{x\to \infty } f^\prime(x)=0$ show: $\lim _{x\to \infty } (f(x+1)-f(x))=0$   Attempt: from $\int \lim _{x\rightarrow \infty } f^\prime(x) \mathrm{d}x=0$ we can say that $f^\prime(x)=const$ would we then have to show that  $\lim _{x\to \infty } (f(x+1))$ is also a constant? From there if we show that both are equal then the difference is zero. I am on the right track?  Thank you for the help. Possible Duplicate:          I have tried using \text{\~{}} to draw a tilde in math mode. However, this only produces a superscript tilde.  I have looked around at many pages such as this one:   and surprisingly, I can't find where to draw a tilde in math mode (not under or above a character - just a single tilde character). If I just use ~, then nothing appears. Probability of the union of $3$ events? I need some clarification for why the probability of the union of three events is equal to the right side in the following:  $$P(E\cup F\cup G)=P(E)+P(F)+P(G)-P(E\cap F)-P(E\cap G)-P(F\cap G)+P(E\cap F\cap G)$$  What I don't understand is, why is the last term(intersection of all) added back just once, when it was subtracted three times as it appears from a Venn Diagram?  Here on page 3, this is explained but not in enough details that I can understand it: Error 1052 Field is Ambiguous using Inner Join Function Can I still command/control concentration spells while in the Border Ethereal? If I have cast something like Animated Objects or Bigby's Hand and then follow up the next round with casting Etherealness, can I still command/control those spells?