title: How does JVM implement the varargs?
body: <p>I recently got interested in such a feature in Java, as functions with variable number of arguments. This is a very cool feature. But I'm interested:</p>
  
  
  
  <pre class="lang-java prettyprint-override"><code>void method(int x, String.. args) {
    // Do something
  }
  </code></pre>
  
  <p>How is this actually implemented on the runtime level? What comes to my mind, is that when we have a call:</p>
  
  <pre class="lang-java prettyprint-override"><code>method(4, "Hello", "World!");
  </code></pre>
  
  <p>The last two arguments are internally transformed into an array, that is passed to the method. Am I right about this, or the JVM actually pushes in the stack refereneces to the strings, not just one reference to the array?</p>