Hi,

Can anyone tell me what is wrong with this code? It seems to be throwing me some error: non-static method getName() cannot be referenced from a static context.

 public void printOrders()
    {
        for(Order filename: Orders) {

         System.out.println("Name: " + Order.getName()); 
         System.out.println("Quantity: " + Order.getQuantity());

        }
    }

Order is the class name. YOu use it to refer to static variables and methods of the class. If those are instance (non-static) methods then you need to call them with an instance of the class, eg filename

Oh, thanks that was a silly mistake. Just wondering what are static variables?