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.
I'm almost finishing coding and checking what I wrote in the mean time. I have a simple question about declaring a reference. Sun says we should create object in the smallest scope needed for the object, that's ok but what about reference? Which one is more appropriate? Pay attention to "String  myArray" declaration please.
It is the location of the the reference declaration that determines the scope of an object not where you create the object. In your example the second option is better as the variable is declared and only in the block of code that it is used in. This makes the code easier to understand.