title: Cannot access data with LinkedList
body: <p>I have classes named Item, Store, Customer and Online(for online customer).</p>
  
  <p><strong>Item</strong></p>
  
  <pre><code>public class Item{
     public Item(String code, String name){
        this.code = code;
        this.name = name;
     }
     @Override
     public String toString(){
        return name + " : " + code;
  }
  </code></pre>
  
  <p><strong>Store</strong></p>
  
  <pre><code> public class Store{
          private LinkedList&lt;Item&gt; items = new LinkedList&lt;Item&gt;();
          public Store(String name, String number){
              this.name = name;
              this.number = number;
          }
         public void addItem(String code, String name){
            items.add(new Item(this, code, name);
         }
         @Override
         public String toString() {
         StringBuilder sb = new StringBuilder();
         for (Item item : items) {
              sb.append(item.toString()).append(System.lineSeparator());
         }
         return sb.toString();
      }
  
      public void viewStore(){
          System.out.println(name + " " + number);
      }
  }
  
  
  </code></pre>
  
  <p><strong>Customer</strong></p>
  
  <pre><code> import java.util.LinkedList;
  
  class Customer {
      private LinkedList&lt;Store&gt; stores = new LinkedList&lt;Store&gt;();
  
      public Customer() {
          stores.add(new Store("Game", "1"));
          stores.add(new Store("Grocery", "2"));
  
          stores.get(0).addItem("001A", "GTA");
          stores.get(0).addItem("001B", "GOD OF WARS");
          stores.get(0).addItem("001C", "THE LAST OF US");
  
          stores.get(1).addItem("002A", "Sandwich");
          stores.get(1).addItem("002B", "Cup Noodle");
          stores.get(1).addItem("002C", "Ice Cream");
      }
      public static void main(String[] args) {
          new Customer().viewStore();
          System.out.println();
          new Customer().viewItem();
      }
  
      public void viewStore(){
          for(Store store: stores)
              store.viewStore();
      }
  
      public void viewItem(){
          for(Store store: stores)
              System.out.println(store);
      }
  }
  </code></pre>
  
  <p><strong>Online</strong></p>
  
  <pre><code>import java.util.*;
  class Online {
      private LinkedList&lt;Item&gt; items = new LinkedList&lt;Item&gt;();
      private String name;
      private String number;
      public Online(String name, String number){
        this.name=name;
        this.number = number;
      }
  
      public static void main(String args[]){
         new Online("John", "123").viewItem();
      }
  
  
      private void viewItem(){
         for(Item item: items)
             System.out.println(item);
      }
  }
  
  </code></pre>
  
  <p>I try to access items data under 'Online' class but failing constantly;</p>
  
  <pre><code>for(Item item: items)
      System.out.println(item)
  </code></pre>
  
  <p>I though the output would be like this </p>
  
  <pre><code>   GTA : 001A
     GOD OF WARS : 001B
     THE LAST OF US: 001C
  
     Sandwich: 002A
     Cup Noodle: 002B
     Ice Cream: 002C
  </code></pre>
  
  <p>But instead it print out NOTHING.</p>
  
  <p>Can someone explain to me? I think I am wrong with adding or accessing data.</p>
  
  <p>Also, for testing purposes. Can you tell me how can I check?</p>