title: how does void methods behaves when passing object reference or primitive types as a parameter
body: <p>I have class which has void methods. </p>
  
  <p>My question is, how does these methods executing. As my stringBuilderAppend() is a void method but when i call this method its returning the values which is been appended inside that method  and I m doing the same check with other two method (i.e, stringAppend() and addNumbers() ) which are not returning anything.</p>
  
  <pre><code>  public class VoidMethodChecker {
      public static void main(String... a){
          StringBuilder stringBuilder = new StringBuilder("first StringBuilder ");
          stringBuilderAppend(stringBuilder);
  
          String string = "first String ";
          stringAppend(string);
  
          int number = 0;
          addNumber(number);
  
  
          /* stringBuilderAppend method prints "first StringBuilder second StringBuilder"
          *  why does stringBuilder() returning the appended value. (my stringBuilder() is void method) 
          *  as other two method does not appending*/
  
          System.out.println(stringBuilder);     // it prints "first StringBuilder second StringBuilder"
  
          System.out.println(string);            // it prints "first String"
          System.out.println(number);            // it prints "0"
      }
  
      private static void stringBuilderAppend(StringBuilder stringBuilder) {
          stringBuilder.append("second StringBuilder");
      }
  
      private static void addNumber(int number){
          number = 120;
      }
  
      private static void stringAppend(String string){
          string += "second String";
      }
  }
  </code></pre>
  
  <p>Thanks</p>