title: How to add fruit to array java?
body: <p>I have to write two methods for a Fruit program that involves arrays. One of them is <code>public void addFruit(String other)</code> and the other is <code>public void deleteFruit(String del)</code>. I have already done the <code>deleteFruit</code>. </p>
  
  <p>How do I do the addFruit? </p>
  
  <p>I don't what the code is or how to code it.</p>
  
  <pre><code>public class Fruit {
  
  private String[] bowl;
  
  public Fruit()
  {
      bowl = new String[10];
      bowl[0] = "apple";
      bowl[1] = "banana";
      bowl[2] = "kiwi";
      bowl[3] = "lemon";
      bowl[4] = "lime";
      bowl[5] = "mango";
      bowl[6] = "orange";
      bowl[7] = "pear";
      bowl[8] = "pineapple";
      bowl[9] = "plum";
  }
  
  
  
  public Fruit(int x)
  {
      bowl = new String[] {"apple", "banana", "lemon", "lime", "mango"};
  }
  
  
  public void display()
  {
      for (int x = 0; x &lt; bowl.length; x++)
          System.out.println(bowl[x]);
  }
  
  public void deleteFruit(String del)
  {
      int index = -1;
      for(int i=0; i&lt; bowl.length; i++)
          if (bowl[i].equals(del))
              index = i;
      if (index ==-1)
          System.out.println("Not in the list");
      else
      {
          for (int i = index; i&lt; bowl.length -1; i++)
              bowl[i] = bowl [i+1];
          String[] temp = new String[bowl.length-1];
          for (int i = 0; i &lt; temp.length; i++)
              temp[i]= bowl [i];
          bowl = temp;
          System.out.println("item deleted");
      }
  public void addFruit(String other)
  {
  
  }
  }
  </code></pre>