title: Declaring int[] Array without defining size?
body: <p>This is my code:</p>
  
  <pre><code>int[] primes = new int[25];
  
      for (int i = 2; i &lt;= 100; i++)
      {
          for (int j = i; j &gt; 0; j--)
          {
              int prime = i%j;
              if (prime == 0)
              {
                  if ((j == i) || (j == 1))
                  {
                      isPrime = true;
                  }
                  else
                  {
                      isPrime = false;
                      break;
                  }
              }
          }
  
          if (isPrime == true){
              primes[index] = i;
              index++;
          }
      }
  </code></pre>
  
  <p>As you can see, I'm writing prime numbers into array. I counted all the prime numbers that are within range 2-100, so I set array size to 25.</p>
  
  <p>But let's say that I wouldn't know there are 25 prime numbers. Is there a way to create an array (any type of array) without defining the size? I tried this:</p>
  
  <pre><code>int[] primes = new int[0];
  </code></pre>
  
  <p>But it crashed.</p>