title: randomly remove element from array java
body: <p>I am removing elements from an array in the below code. In this particular code I am removing the element at pos 2. How would I go about removing a random element in this array?</p>
  
  <pre><code>public class QuestionOneA2 {
  
  public static void main(String[] args) {
      int size = 5;
      int pos = 2;
  
      String[] countries = {"Brazil", "France", "Germany", "Canada", "Italy", "England"};
  
          for (int i = 0; i &lt; size; i++) {
              if(i == pos) {
                  countries[i] = countries[size];
              }
              System.out.println(countries[i]);
          }   
      }
  }
  </code></pre>