title: Why can I pass a primitive to a method that takes an object?
body: <p>Why is it possible to pass a primitive to a method that takes an object? Is the primitive turned into an object? like int = Integer and boolean = Boolean?</p>
  
  <p>I can call the following function:</p>
  
  <pre><code>hash(41, 0);
  
      public static int hash(int seed, Object object)
      {
          int result = seed;
          if(object == null)
          {
              return hash(result, 0);
          }
          else if(!isArray(object))
          {
              result = hash(result, object.hashCode());
          }
          else
          {
              int length = Array.getLength(object);
              for(int index = 0; index &lt; length; ++index)
              {
                  Object item = Array.get(object, index);
                  // prevent looping if item in array references the array itself
                  if(!(item == object))
                  {
                      result = hash(result, item);
                  }
              }
          }
          return result;
      }
  </code></pre>