title: How to pass a linked list in Java?
body: <p>I am having trouble understanding how to pass a linkdlist into a method that display that list as a stack. I am aware i havent specifed the type of list but my instructor said that it would not matter for this purpose. but I am still learning so I'm not to sure if I am passing the linkedlist correctly into the method. </p>
  
  <pre><code>import java.util.LinkedList ;
  import java.util.ListIterator;
  
  public class UseStacksAndQueues{
  
    public static void main(String[] args) {
  
        StacksAndQueues sQ = new StacksAndQueues();
        String [] days = {"mon","tue","wed","thur","fri", "sat","sun"};
        LinkedList aList = new LinkedList();
        LinkedList newList = new LinkedList();
  
        //load array of string objects into linked list
        aList = sQ.methodOne(days);
  
        //display linked list as a stack
        sQ.methodTwo(aLits);
  </code></pre>
  
  <p>the method.</p>
  
  <pre><code>//display a linked list as a stack 
  public LinkedList methodTwo(aList){
  
       for(int i = aList.size; i &lt;= 0; i--)
       {
          System.out.println(aList.get(i));
  
       }
  
  }//end method two
  </code></pre>