title: Can someone explain to me what the reasoning behind passing by "value" and not by "reference" in Java is?
body: <p>I'm fairly new to Java (been writing other stuff for many years) and unless I'm missing something (and I'm happy to be wrong here) the following is a fatal flaw...</p>
  
  <pre><code>String foo = new String();
  thisDoesntWork(foo);
  System.out.println(foo);//this prints nothing
  
  public static void thisDoesntWork(String foo){
     foo = "howdy";
  }
  </code></pre>
  
  <p>Now, I'm well aware of the (fairly poorly worded) concept that in java everything is passed by "value" and not "reference", but String is an object and has all sorts of bells and whistles, so, one would expect that unlike an int a user would be able to operate on the thing that's passed into the method (and not be stuck with the value set by the overloaded =).</p>
  
  <p>Can someone explain to me what the reasoning behind this design choice was? As I said, I'm not looking to be right here, and perhaps I'm missing something obvious?</p>