title: When creating methods and passing objects as parameters, are they copied or referenced?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/40480/is-java-pass-by-reference">Is Java pass by reference?</a>  </p>
  </blockquote>
  
  
  
  <p>see example below... need java.io library to run...</p>
  
  <pre><code>public class BlankClass extends ConsoleProgram {
  
  public void run() {
      while(true) {
           setFont("London-24");
           String name = readLine("Type a name: ");
           fixName(name);
           /* I know that the way this is written doesn't make sense and that println(fixName(name))
            * is the right way.  However, I thought that when objects then the method is using the object
            * (in this case a string) and not a copy of it. In other words, it is referenced.
            * So if it is referenced why isn't it printing out Steven when I give it STEVEN.
            */
           //println(fixName(name); this is removed to show the question.
             println(name);
      }
  }
  
  private String fixName(String name) {
      char first = name.charAt(0);
      first = Character.toUpperCase(first);
      name = name.substring(1);
      name = first + name.toLowerCase();
      return name;
  }
  
  }
  </code></pre>