This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
i am in a strange situation, i have a class which is returning one value at a time and returning the string finally one at a time,
but here on one condition the list has to return 2 values so i can change that code but the return value will be array,but return type is just string
how to handle this. the sample code i want to change as.
Before we go into how to address your question as asked, let's take a step back and get the big picture. Why do you think you need to sometimes return a String and sometimes an array? What is this method's job--what does it do and what does it produce--in non-Java terms?
I can think of at least 3 different ways to do what you want, but they're basically just band-aids on a broken design.