title: Shorten array length once element is remove in Java
body: <p>Note:
    Following is my homework/assignment, feel free not to answer if you will.</p>
  
  <p>I want to delete/remove an element from an String array(Set) basic, I'm not allowed to use Collections..etc.</p>
  
  <p>Now I have this:</p>
  
  <pre><code>void remove(String newValue) {
  
              for ( int i = 0; i &lt; setElements.length; i++) {
                 if ( setElements[i] == newValue ) {
                      setElements[i] = "";
  
                 }
              }
  
         }   
  </code></pre>
  
  <p>I does what I want as it remove the element from an array but it doesn't shorten the length. The following is the output, basically it remove the element indexed #1.</p>
  
  <pre class="lang-none prettyprint-override"><code>D:\javaprojects&gt;java SetsDemo
  Enter string element to be added
  A
  You entered A
  Set size is: 5
  Member elements on index: 0 A
  Member elements on index: 1 b
  Member elements on index: 2 hello
  Member elements on index: 3 world
  Member elements on index: 4 six
  Set size is: 5
  Member elements on index: 0 A
  Member elements on index: 1
  Member elements on index: 2 hello
  Member elements on index: 3 world
  Member elements on index: 4 six
  </code></pre>