package basic;  class TestIt {      static void doIt(int[] z) {         z = null;     } }  class Arraydemo {     public static void main(String[] args) {         int[] myArray = { 1, 2, 3, 4, 5 };          TestIt.doIt(myArray);          for (int j = 0; j &lt; myArray.length; j++)             System.out.print(myArray[j] + " ");     }  }   can any1 please explain why the output for code is 1,2,3,4,5. ....................................................................................................................................................................................................................
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?
One thing I liked about Mint was that the terminal would usually show two colors: everything from the left to the $ would be one color, and everything past the $ would be another.   Is there a way to have this setup with Ubuntu? Proving the summation formula using induction: $\sum_{k=1}^n \frac{1}{k(k+1)} = 1-\frac{1}{n+1}$ What is the most elegant way to check if the directory a file is going to be written to exists, and if not, create the directory using Python? Here is what I tried:  import os  file_path = "/my/directory/filename.txt" directory = os.path.dirname(file_path)  try:     os.stat(directory) except:     os.mkdir(directory)         f = file(filename)   Somehow, I missed os.path.exists (thanks kanja, Blair, and Douglas). This is what I have now:  def ensure_dir(file_path):     directory = os.path.dirname(file_path)     if not os.path.exists(directory):         os.makedirs(directory)   Is there a flag for "open", that makes this happen automatically? This is a question that has received various answers. This questions seems simple, but it proves to be rather tricky.  So :  We flip a coin (H-T) independently $10$ times. Let's for the moment not care about whether it is fair or not.   How many $3$-head sequences are there?  Solution:  Some say that the answer is $\displaystyle\frac{10!}{7!3!}$, but this is the number of ways  by which $3$ heads can be arranged in $10$ positions. This answer , however, does not say anything about the remaining $7$ positions.   Each of these seven positions can be H or T. The total number of $7$-element sequences is $1\cdot1\cdot1\cdot2^7=2^7$. Then we have to multiply this by $\displaystyle\frac{10!}{7!3!}$ as the three heads can be anywhere. But I have found that this is not the correct answer. The correct is just $\displaystyle\frac{10!}{7!3!}$. So why not multiply by $2^7$? Remove a part of a list of names I have some files and each files have distinct name but all of them have the same "-statement" at the end like this:  flower-statement.mp3 leave-statement.mp3  ball-statement.mp3 goal-statement.mp3   So I want to remove this: -statement  Is that possible? $\sum x_n^2$ and $\sum y_n^2$ converge, what does $\sum (x_n + y_n)^2$ do? So I know that $\sum x_n^2$ converges, and $\sum y_n^2$ converges. ${x_n}$ and ${y_n}$ are both sequences of real numbers. How can I prove that $$\sum(x_n+y_n)^2$$ converges? So far I have $$\sum(x_n+y_n)^2=\sum(x_n)^2 +\sum (y_n)^2 +\sum(2x_ny_n)$$ so I need to prove that $\sum 2x_ny_n$ converges. Is this the right way to approach it? If it is, I am completely lost as to the next step.  I also need to prove that $$\sqrt{\sum(x_n+y_n)^2}\leq \sqrt{\sum(x_n)^2}+\sqrt{\sum(y_n)^2}$$  I assume this will follow pretty easily from a result in the first proof, but I'm stuck on that now, and perhaps it is easier to start with the second one. I have a lot of work I've done on the first problem, but none of it seemed to go anywhere. Any hints?  Thanks! I am using MiKTeX 2.9 on Windows 7.   I'm getting the error: "can't write on pdf file."  The pdf doesn't reflect what I wrote.  What did I do wrong?  My input:  \documentclass[12pt]{article} \usepackage{epsf} \usepackage{amssymb} \usepackage{graphicx} \usepackage{setspace} \usepackage{amsmath} \usepackage{rotate} \usepackage{endnotes} %\usepackage{harvard} \usepackage{vmargin} \usepackage[nolists,noheads,tablesfirst,nomarkers]{endfloat} \usepackage{natbib} \bibliographystyle{apsr}  \oddsidemargin=1.0in\evensidemargin=0.in \textheight=8.5in\textwidth=6.6 in \baselineskip=18pt \parskip=6pt  \begin{document}  % added, was missing  TEXT  \newpage \baselineskip=12pt \doublespacing  \bibliographystyle{apsa} \bibliography{Dissertation_Proposal}   \end{document} If you visit a chat room attached to a beta site while logged out, the log in message is all but unreadable, being dark grey on a dark blue background. For example, visit  while logged out or in private browsing mode. What is the maximum party size and the corresponding monster buffs? What is the maximum party size (if there is one) in Diablo 3?  Additionally, how much of a buff do monsters get when adding party members?     "A new ally has joined, but the minions of Hell grow stronger." I read recently that you can find the number of digits in a number through the formula $\lfloor \log_{10} n \rfloor +1$ What's the logic behind this rather what's the proof? How do you transpose tensors? We transpose a matrix $A$ by replacing $A_{ij}$ with $A_{ji}$, for all $i$ and $j$.  However, in case $A$ has more than two dimensions (that is, it is a tensor), I don't know how to apply the transpose operation.   If A has dimensions $3\times 3 \times 8$, then what will replace $A_{ijk}$?  If $A$ has shape $3\times 3\times 8\times 8$, then what will replace $A_{ijkl}$? I am currently writing an essay on artificial moral agents, and I need to explain the difference between ethics and morals. However, I am finding it really hard to find a good book or research paper which contains a citable definition.   Could someone point me in the right direction? Quotient ring of a localization of a ring Let $A$ be a commutative ring. Let $P$ be a prime ideal of $A$. Let $I$ be an ideal of $A$ such that $I \subset P$. Let $\bar A = A/I$. Let $\bar P = P/I$. Is $\bar A_{\bar P}$ isomorphic to $A_P/IA_P$? In the sentence: "I didn't know she had a son,"   Can I say "I didn't know she has a son" instead, because he is a teenager now?  Or are both correct? Regaining control of a group after being removed by another admin I created a Facebook group and was later removed by another admin.   How do I get my group back? sudo apt-get upgrade installs all updates, not just security updates. I know that I can use Update Manager to select only important security updates, but is there a way to do this from the command line? What is a less offensive synonym for "hypocrite"? Is there a word that describe a person who doesn't "practice what they preach"? Basically, is there a synonym for "hypocrite" that carries less pejorative connotations?   For example, let's say a friend of mine says he is a Christian. Yet he engages in behaviors considered sins by the Bible, making him a hypocrite. And I would like to tell him I think he is a hypocrite.   What would be a good word to use here, so my criticism seems constructive rather than offensive?     I tried using a , but the synonyms that came up were even worse (ie: they are more offensive than "hypocrite"). Related (but different) question: , which asks what to call someone who knows they are in the group of people they criticize. I'm looking to get the result of a command as a variable in a Windows batch script (see  for the bash scripting equivalent).  A solution that will work in a .bat file is preferred, but other common windows scripting solutions are also welcome. In the DC Comics Universe, What Happens to Earthlings Under a Red Sun? I am often logged in several SSH sessions at once. To logout from several sessions, I press CTRL+d, until I am back on my local machine. However, I occasionally press it once too many, and my terminal exits. Is there a way to make CTRL+d unable to close my terminal ? I am using terminator as my terminal emulator.