title: Passing array of objects in java and saving the array of objects in the called method
body: <p>I wrote some code to return me an array of objects.  How do I save those objects in the called method?</p>
  
  <pre><code>   public Ticket[] getOpenTicket() {
          int ticketcount = 0;
          for (int i = 0; i &lt; ticket.length; i++) {
              if (ticket[i] != null &amp;&amp; ticket[i].getResolvedBy() == null) {
                  ticketcount = ticketcount + 1;
                  // System.out.println("Ticket raised by : " +
                  // ticket[i].getTicketno());
              }
          }
  
          Ticket[] opentickets = new Ticket[ticketcount];
          for (int i = 0; i &lt; ticket.length; i++) {
              if (ticket[i].getResolvedBy() == null) {
                  opentickets[i] = ticket[i];
              }
          }
          return opentickets;
  
      }
  </code></pre>
  
  <p>This is the called function from where I am calling openticket:</p>
  
  <pre><code>TicketDaoMemImpl tdmi=new TicketDaoMemImpl();
  Ticket [] obj1=tdmi.getOpenTicket();
  </code></pre>
  
  <p>Thanks </p>