In Java, non-primitive data types are passed by reference. So, this means whatever change is made to that object will be global. In the code below, a Test object is passed to a static function changeValue() to change the value of its attribute. So, from my knowledge the object is passed by reference, so the output should be:  test1 : Fuzzy   test2 : Billboard  But, the output is:  test1 : Fuzzy   test2 : Wuzzy  What am I missing here? class Test {         private String value; // instance variable          public void setValue(String value) { // setter function         this.value = value;     }          public String getValue() { // getter function         return value;     }          public static void changeValue(Test test, String value) { //Function to change the value of an object         test = new Test();         test.setValue(value);     }          public static void main(String args[]) {         // Object creation         Test test1 = new Test();         Test test2 = new Test();                  // Setting value         test1.setValue(&quot;Fuzzy&quot;);         test2.setValue(&quot;Wuzzy&quot;);                  // Changing value of test2         Test.changeValue(test2, &quot;Billboard&quot;);                  // Printing values of the objects         System.out.println(&quot;test1 : &quot; + test1.getValue());         System.out.println(&quot;test2 : &quot; + test2.getValue());     }  }
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?
How do I remove a directory and all its contents? In bash all I know is that   rmdir directoryname   will remove the directory but only if it's empty. Is there a way to force remove subdirectories? Testing convergence of series $\sum_{n=3}^\infty\frac{1}{n (\ln(n))^p(\ln\ln(n))^q}$ Lets have this problem. $$\sum_{n=3}^\infty\frac{1}{n (\ln(n))^p(\ln\ln(n))^q}$$ I have rewritten this to a form $$\sum\frac{1}{np'^{\ln\ln(n)}q'^{\ln\ln\ln(n)}}$$ For $p,q\in\mathbb{R}$. Obviously, $p',q'&gt;0, p=\ln(p'),q=\ln(q')$ Am I using beta or stable? I have been doing so many sudo apt-get update/(dist-)upgrade since yesterday and  something happend - so that I am confused now whether I am using still beta or the stable version.   How do I figure that out? How to derive the least square estimator for multiple linear regression? The problem statement is: for $a,b$ coprime, prove that there exists positive integers $x,y$ such that $ax-by=1$.  The question is form Arthur Egnels' problem solving text, and from the chapter on the pigeonhole principle.    My question: His proof begins by generating a list $a,\ldots,a(b-1)$, where he then points out that each element in this list(which proceeds sequentially) doesn't have remainder $0\pmod{b}$.  He then shows that we arrive at a contradiction if we assume that we also don't get remainder $1$ in this list $\bmod b$.  To show the contradiction in this last statement, he first states that we would have positive integers $p,q $ where $ 0&lt;p&lt;q&lt;b$ so that $pa\equiv qa \pmod{b}$.  He then goes on to point out that since we $a$ and $b$ are coprime, we then have that $b| q-p$.  I understand the last part here, but don't see why we get $pa\equiv qa \pmod{b}$.  Thanks in advance In the 10 k tools,  is described as if I had approved it:    However, the review item itself (correctly) displays that I rejected this edit:    Going by   , this should be fixed, but it isn’t.  This could be solved by replacing approved by to reviewed by in the list or making an explicit list, who approved and rejected an edit (which is probably more complicated). How do I call one constructor from another in Java? When should I use "a" vs "an"? Please revoke badges gained by abusive voting In  (not feature request), :  ... if we find that people are abusing the system their accounts may get suspended. I would consider that kind of behavior abuse.  Well  sure qualifies. He has 11 Stack Exchange accounts and has in the last day spammed at least 8 of them to gain the Suffrage and sometimes Vox Populi badges. That's over 250 votes† in just a few hours! (And  -- while voting on other user's posts too.) I guarantee that he's not voting on those posts for/by their merits. Here's when he scammed the Suffrage badge per site (while also gaming the Vox Populi on some sites):                      - 2017-03-11 16:23:15Z                     - 2017-03-11 17:41:41Z                     - 2017-03-11 18:08:13Z                           - 2017-03-11 19:25:10Z                  - 2017-03-11 19:55:16Z                               - 2017-03-11 20:00:49Z               - 2017-03-11 20:03:13Z  - 2017-03-11 21:11:40Z  Note that he got the badge on three sites within an 8 minute span (but that might just be job run times). Please revoke badges gained through improper voting. And, maybe also warn/suspend such abusive voters.   † His account vote totals don't show all votes as some serial voting was reversed -- but none of the ill-gotten badges were. The Nazgul are afraid of fire, but can they be harmed by it? When Aragorn and the Hobbits are on Weathertop, just after seeing the Nazgul below them and prior to inflicting Frodo's knife wound, Aragorn says the following:     Sauron can put fire to his evil uses, as he can all things, but these   Riders do not love it, and fear those who wield it. Fire is our friend   in the wilderness.   Is there any mention as to whether fire can actually cause harm to the Nazgul and if not, is there a specific reason for their fear of it? When trying to SSH into a particular Mac machine it gives me the following error :  ssh_exchange_identification: Connection closed by remote host   I have done some google searches on the issue but I haven't seem to find a definite answer. I did notice that on the machine that I am trying to SSH into, it does not have the ~/.ssh file even on there so I went ahead and created it and gave it correct permissions but that didn't help. Here is the verbose of when attempting to SSH into it:  penSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011 debug1: Reading configuration data /etc/ssh_config debug1: /etc/ssh_config line 20: Applying options for * debug1: Connecting to &lt;ComputerName&gt; [xxx.xxx.xxx.xxx] port 22. debug1: Connection established. debug1: identity file /Users/&lt;UserName&gt;/.ssh/id_rsa type 1 debug1: identity file /Users/&lt;UserName&gt;/.ssh/id_rsa-cert type -1 debug1: identity file /Users/&lt;UserName&gt;/.ssh/id_dsa type -1 debug1: identity file /Users/&lt;UserName&gt;/.ssh/id_dsa-cert type -1 debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_6.2 ssh_exchange_identification: Connection closed by remote host   Any ideas on how to get SSH working? Difference between "been to" and "been in" Every Artinian ring is isomorphic to a direct product of Artinian local rings Add ability to flag answers as duplicates Preview Breaks with Invalid Tag Name [tag:+] In the formatted preview for Questions &amp; Answers, typing a tag link with an invalid tag name "crashes" the preview. As soon as you type the following the preview stops updating and an error can be observed in the Javascript console.   [tag:+]   Observed in Safari 7 and Chrome 31.   seems related to the business rule of not allowing certain characters in tags, but it sounds like a different bug. I am having some issues trying to show multiple fields for a single label in QGIS. In QGIS2.6, attempting to display labels for a feature consisting of multiple fields results in an empty label if one of the fields is null. So for example, in the label expression dialog:  concat("Temp Site",'\n',"Notes",'\n',"Function")   will function normally unless one of the fields is null, then it results in no label being shown. Using the '||' operator instead in the expression dialog also results in the same behaviour:  "Temp Site" || '\n'  ||  "Notes" || '\n'  ||  "Function"   Is there a way to display the labels even if one of the fields is null? piping in real time This is more a conceptual thing than a current problem.  Would it be possible to do this:  tail -f &lt;file&gt; | grep "string" | sed 's/stuff//g' &gt;&gt; output.txt  The problem I'm thinking is that tail -f never terminates so it won't progress in the command. I'm trying to read and output a file in real-time. If this doesn't work how would I do it? Where can I safely store my stuff? I'd like to find a place to store stuff while I'm out adventuring, without spending 5000 on a house (at least, until I can afford that...). Where can I safely store items without worrying about them disappearing?   There are two possible places that come to mind,  (to which I have the key and was told I could stay), and the small bedroom given to me at the  (which I was told was mine, despite seeing J'zaro sitting in it later). Can I store items safely in either of these places? Install apt package in ubuntu 12.04 I have mistakenly removed the default package APT from my system .  When I run command locate apt-get, I get below output:  /home/jeet/apt-get /home/jeet/Desktop/apt/apt-0.7.25.3ubuntu9.13/cmdline/apt-get.cc /home/jeet/Desktop/apt/apt-0.7.25.3ubuntu9.13/doc/apt-get.8.xml /home/jeet/Desktop/apt/apt-0.7.25.3ubuntu9.13/doc/de/apt-get.de.8 /home/jeet/Desktop/apt/apt-0.7.25.3ubuntu9.13/doc/fr/apt-get.fr.8 /home/jeet/Desktop/apt/apt-0.7.25.3ubuntu9.13/doc/ja/apt-get.ja.8 /home/jeet/Downloads/apt-get /home/jeet/Downloads/apt-get.8.gz /usr/share/bash-completion/completions/apt-get /usr/share/bash-completion/completions/slapt-get   If I run ls | grep apt-get, then I won't get any output.  Can anybody please advice how to recover apt package or install it from start? Why would an incorrect password attempt take a lot longer to process than a correct one? The most prominent place I've noticed this is when SSH-ing at work, but I feel like I've observed this behaviour elsewhere too.  When I try to log into Linux servers from my Windows desktop at work, I've noticed that if I mis-type my password, it takes a good 5 seconds or so before I get "Access Denied" back. Then when I type my password correctly, the login (along with welcome messages etc) is virtually instant.  Is there any logical reason for this, or would it be down to some odd configuration that's specific to the machines here at work?