This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
So I'm working towards my Java 5/6 associate exam and doing practice questions. I came across this problem, I have the way I did and and the way it should be done. Just need to know why the right way is right.
the "shirt class"
What i had to do was create a ShirtArrayTest class and compile both. this is my ShirtArrayTest class
Dont worry, it happens all the time. Just keep an eye on the results from the compiler. They will guide you on what the problem is and most of the times on the solution too.
If you fix the spelling mistake, it should work without any problems. Regarding your question on which way is better, I would say... it depends! Using the first approach, you write less code, which is good if you don't want to do lots of things with your objects. Using the second approach, you write more code (not always a bad thing, because it improves readability). So, in our case where you simply want to invoke one method, the first approach should be ok. But if you wanted to do more with the objects stored in your table, you should follow the second approach.
Hope the above helped you a little bit.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com