Orders and Customers classes had same attributes CustomerName,OrderId,CustomerId,flag, getters and setters.
This doesn't sound good. Why would you then need two classes?
The quieter you are, the more you are able to hear.
Joined: Jan 17, 2007
Sorry I missed one line. Here is correct code . And Orders class having 100 fields but Customers class having only 4 fields :CustomerName,OrderId,CustomerId,flag
public void copyList(List<Orders> orders)
List<Customers> cOrders = new ArrayList<Customers>();
for(Orders order : orders)
for (Customers cOrder: cOrders)
System.out.println(cOrders); //This is giving output as 
Joined: Aug 05, 2005
You're still not creating any Customers instances. Instead of the inner for loop you should be creating a Customers instance and adding it to the cOrders list.