<p>Java has a special way that you can document your methods such that it will create documentation for you if you follow the convention.</p>
<p>The Java API actually uses this technique to produce its own documentation.</p>
<p>To create this, indicate a method with special comments that begin with <code>/**</code> and ends with <code>*/</code></p>
<p>It contains <em>block tags</em> that describe input and output parameters</p>
<p><code>@param</code> and <code>@return</code></p>
<h3>Example</h3>
<pre><codeclass="language-java">/**
* @param y an integer to sum
* @param x an integer to sum
* @return the sum of x and y
*/
public int multiply(int x, int y) {
return x + y;
}</code></pre>
<h2>Passing a Scanner</h2>
<p>We only want to create one <strong>user input scanner</strong> per program, we also only want one <strong>file input scanner</strong> per program.</p>
<p>If a method needs a scanner, you can pass the one you already created in as an input parameter.</p>
<h2>Array as Input Parameter</h2>
<p>Primitive types (<code>int</code>, <code>char</code>, <code>double</code>, etc.) are passed by value. Modifications made inside a method cannot be seen outside the method.</p>
<p>Arrays on the other hand, is pass by reference. Changes made to an array inside the method can be seen outside the method.</p>
<p>At the end of the <code>timesTwo</code> method call, the variable <code>nums</code> would have <code>{2, 6, 10, 14, 18}</code></p>
<h2>Sizes of Arrays</h2>
<h3>Perfect Size Arrays</h3>
<p>When we declare an array, Java automatically fills every slot of the array with the type in memory. So if you know that you need exactly 8 slots, then you only ask for 8.</p>
<h3>Oversize Arrays</h3>
<p>This is when we don't know how many slots we need. Therefore, we ask for more than we think we'll need. That way we don't go out of bounds.</p>
<p>If we do this, then we don't know how many elements we have already inserted into the array. Since the length is the number of slots.</p>
<p>So we can create another variable, which will keep track of the index in where we can add the next element.</p>
<p>We use oversized arrays when the size of the array is unknown or may change.</p>